Submission #994735

# Submission time Handle Problem Language Result Execution time Memory
994735 2024-06-08T04:44:16 Z emptypringlescan Portal (BOI24_portal) C++17
0 / 100
1 ms 860 KB
#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 time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 604 KB Output is correct
2 Correct 1 ms 860 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -