Submission #1059136

#TimeUsernameProblemLanguageResultExecution timeMemory
1059136TonylPortal (BOI24_portal)C++17
0 / 100
0 ms348 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; using vi = vector<int>; using pi = pair<ll,ll>; #define REP(i,n) for (int i = 0; i < n; i++) #define trav(a,x) for (auto& a : x) #define D(x) cerr << #x << ": " << x << endl; #define all(x) (x).begin(), (x).end() int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n; cin >> n; if (n == 2) { cout << "-1" << endl; return 0; } vector<pi> p(n); vector<pi> p2(n); REP(i,n) { cin >> p[i].first >> p[i].second; p2[i].second = p[i].first; p2[i].first = p[i].second; } sort(all(p)); sort(all(p2)); ll mx = 1e10; ll my = 1e10; REP(i,n) { if (i==0) continue; if (p[i-1].first!=p[i].first) mx = min(mx, p[i].first-p[i-1].first); if (p2[i-1].first!=p2[i].first) my = min(my, p2[i].first-p2[i-1].first); } cout << 1+(mx-1)*(my-1)+(mx-1)+(my-1) << endl; }
#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...