제출 #994649

#제출 시각아이디문제언어결과실행 시간메모리
994649pavementPortal (BOI24_portal)C++17
0 / 100
1 ms348 KiB
#include <bits/stdc++.h> using namespace std; #define pb push_back int N, horiz, vert, x[100005], y[100005]; map<int, vector<int> > row, col; int main() { ios::sync_with_stdio(0); cin.tie(0); cin >> N; for (int i = 1; i <= N; i++) { cin >> x[i] >> y[i]; row[x[i]].pb(y[i]); col[y[i]].pb(x[i]); } for (auto i : row) { sort(i.second.begin(), i.second.end()); if (i.second.size() > 1) { for (int j = 0; j + 1 < (int)i.second.size(); j++) { horiz = __gcd(horiz, i.second[j + 1] - i.second[j]); } } } for (auto i : col) { sort(i.second.begin(), i.second.end()); if (i.second.size() > 1) { for (int j = 0; j + 1 < (int)i.second.size(); j++) { vert = __gcd(vert, i.second[j + 1] - i.second[j]); } } } cout << (long long)horiz * vert << '\n'; }
#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...