Submission #994735

#TimeUsernameProblemLanguageResultExecution timeMemory
994735emptypringlescanPortal (BOI24_portal)C++17
0 / 100
1 ms860 KiB
#include <bits/stdc++.h> using namespace std; int grid[105][105]; vector<pair<int,int> > step; void dfs(int x, int y){ if(x<0||x>100||y<0||y>100) return; if(grid[x][y]) return; grid[x][y]=1; for(pair<int,int> i:step){ if(x+i.first>=0&&x+i.first<=100&&y+i.second>=0&&y+i.second<=100) 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) cout << -1; else{ for(int i=0; i<n; i++){ for(int j=0; j<n; j++){ if(i==j) continue; step.push_back({arr[i].first-arr[j].first,arr[i].second-arr[j].second}); } } int cnt=0; for(int i=0; i<100; i++){ for(int j=0; j<100; j++){ if(grid[i][j]) continue; cnt++; dfs(i,j); } } cout << cnt; } }
#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...