Submission #1213993

#TimeUsernameProblemLanguageResultExecution timeMemory
1213993stefanneaguPortal (BOI24_portal)C++20
1 / 100
25 ms1864 KiB
#include <bits/stdc++.h> #define int long long using namespace std; const int inf = 1e18, nmax = 1e5; pair<int, int> v[nmax]; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int n; cin >> n; if (n <= 2) { cout << -1; return 0; } for (int i = 1; i <= n; i++) { cin >> v[i].first >> v[i].second; } sort(v + 1, v + n + 1); int maxx = 1; for (int i = 2; i <= n; i++) { if (v[i].first != v[i - 1].first) maxx = max(maxx, abs((v[i].first - v[i - 1].first) - 1) * abs(v[i].second - v[i - 1].second)); if (v[i].second != v[i - 1].second) maxx = max(maxx, abs(v[i].first - v[i - 1].first) * (abs(v[i].second - v[i - 1].second) - 1)); } for (int i = 1; i <= n; i++) { swap(v[i].first, v[i].second); } sort(v + 1, v + n + 1); for (int i = 2; i <= n; i++) { if (v[i].first != v[i - 1].first) maxx = max(maxx, abs((v[i].first - v[i - 1].first) - 1) * abs(v[i].second - v[i - 1].second)); if (v[i].second != v[i - 1].second) maxx = max(maxx, abs(v[i].first - v[i - 1].first) * (abs(v[i].second - v[i - 1].second) - 1)); } cout << maxx; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...