Submission #994749

#TimeUsernameProblemLanguageResultExecution timeMemory
994749emptypringlescanPortal (BOI24_portal)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; int grid[1005][1005]; vector<pair<int,int> > step; void dfs(int x, int y){ if(x<0||x>1000||y<0||y>1000) return; if(grid[x][y]) return; grid[x][y]=1; for(pair<int,int> i:step){ if(x+i.first>=0&&x+i.first<=1000&&y+i.second>=0&&y+i.second<=1000){ if(grid[x+i.first][y+i.second]==0) dfs(x+i.first,y+i.second); } } } int32_t main(){ ios::sync_with_stdio(0); cin.tie(0); int n; cin >> n; pair<int,int> arr[n]; for(int i=0; i<n; i++) cin >> arr[i].first >> arr[i].second; if(n==2||n==1) cout << -1; else{ int gx=-1,gy=-1; for(int i=1; i<n; i++){ int dx=abs(arr[i].first-arr[0].first),dy=abs(arr[i].second-arr[0].second); if(dx){ if(gx==-1) gx=dx; else gx=gcd(gx,dx); } if(dy){ if(gy==-1) gy=dy; else gy=gcd(gy,dy); } } if(dx==-1||dy==-1) cout << -1; else cout << dx*dy; } }

Compilation message (stderr)

Main.cpp: In function 'int32_t main()':
Main.cpp:36:6: error: 'dx' was not declared in this scope; did you mean 'gx'?
   36 |   if(dx==-1||dy==-1) cout << -1;
      |      ^~
      |      gx
Main.cpp:36:14: error: 'dy' was not declared in this scope; did you mean 'gy'?
   36 |   if(dx==-1||dy==-1) cout << -1;
      |              ^~
      |              gy