Submission #1051446

#TimeUsernameProblemLanguageResultExecution timeMemory
1051446deeraPortal (BOI24_portal)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; struct Portal { public: int x; int y; }; void print(Portal p) { cout << p.x << " " << p.y << endl; } void solve() { int n; cin >> n; vector<Portal> portals(n); for (int i = 0; i < n; i++) cin >> portals[i].x >> portals[i].y; if (n <= 2) return (void)(cout << -1 << endl); int box_x = 0; int box_y = 0; Portal c = portals[0]; for(auto p: portals) { box_x = __gcd(abs(p.x - c.x), box_x); box_y = __gcd(abs(p.y - c.x), box_y); } int n = box_x * box_y; if (n == 0) cout << -1 << endl; else cout << n << endl; } int main() {solve();}

Compilation message (stderr)

Main.cpp: In function 'void solve()':
Main.cpp:33:9: error: redeclaration of 'int n'
   33 |     int n = box_x * box_y;
      |         ^
Main.cpp:15:9: note: 'int n' previously declared here
   15 |     int n;
      |         ^