fork download
  1. #include <vector>
  2. #include <iostream>
  3. #include <algorithm>
  4. using namespace std;
  5. int main () {
  6. int n;
  7. vector<int> x, y;
  8. cin >> n;
  9. for (int i = 0; i < n; i++) {
  10. cin >> x[i] >> y[i];
  11. }
  12. sort (x.begin(), x.end());
  13. sort (y.begin(), y.end());
  14. int r = (x[n - 1] - x[0]) * (y[n - 1] - y[0]);
  15. if (r <= 0) cout << -1;
  16. else cout << r << endl;
  17. return 0;
  18. }
Runtime error #stdin #stdout 0s 3456KB
stdin
1 -1 -1
stdout
Standard output is empty