# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
994721 |
2024-06-08T04:28:05 Z |
hmm789 |
Portal (BOI24_portal) |
C++14 |
|
2000 ms |
1372 KB |
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
int32_t main() {
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int n, ans = 0;
cin >> n;
int x[n], y[n];
for(int i = 0; i < n; i++) cin >> x[i] >> y[i];
int X = 301, Y = 301;
int grid[X][Y];
memset(grid, -1, sizeof(grid));
for(int i = 0; i < X; i++) {
for(int j = 0; j < Y; j++) {
if(grid[i][j] != -1) continue;
queue<pair<int, int>> q;
q.push({i,j});
grid[i][j] = ans;
while(!q.empty()) {
pair<int, int> c = q.front();
q.pop();
for(int r = 0; r < n; r++) {
for(int s = 0; s < n; s++) {
int nx = c.first+x[r]-x[s];
int ny = c.second+y[r]-y[s];
if(nx < 0 || nx >= X || ny < 0 || ny >= Y) continue;
if(grid[nx][ny] != -1) continue;
grid[nx][ny] = ans;
q.push({nx, ny});
}
}
}
ans++;
}
}
if(ans >= 300) cout << -1;
else cout << ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
600 KB |
Output is correct |
2 |
Correct |
3 ms |
600 KB |
Output is correct |
3 |
Correct |
3 ms |
604 KB |
Output is correct |
4 |
Correct |
3 ms |
808 KB |
Output is correct |
5 |
Correct |
3 ms |
604 KB |
Output is correct |
6 |
Correct |
3 ms |
600 KB |
Output is correct |
7 |
Correct |
3 ms |
804 KB |
Output is correct |
8 |
Correct |
4 ms |
604 KB |
Output is correct |
9 |
Correct |
3 ms |
600 KB |
Output is correct |
10 |
Correct |
4 ms |
804 KB |
Output is correct |
11 |
Correct |
3 ms |
604 KB |
Output is correct |
12 |
Correct |
3 ms |
600 KB |
Output is correct |
13 |
Correct |
3 ms |
604 KB |
Output is correct |
14 |
Correct |
3 ms |
604 KB |
Output is correct |
15 |
Correct |
3 ms |
604 KB |
Output is correct |
16 |
Correct |
4 ms |
604 KB |
Output is correct |
17 |
Correct |
3 ms |
604 KB |
Output is correct |
18 |
Correct |
5 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
600 KB |
Output is correct |
2 |
Correct |
3 ms |
600 KB |
Output is correct |
3 |
Correct |
3 ms |
604 KB |
Output is correct |
4 |
Correct |
3 ms |
808 KB |
Output is correct |
5 |
Correct |
3 ms |
604 KB |
Output is correct |
6 |
Correct |
3 ms |
600 KB |
Output is correct |
7 |
Correct |
3 ms |
804 KB |
Output is correct |
8 |
Correct |
4 ms |
604 KB |
Output is correct |
9 |
Correct |
3 ms |
600 KB |
Output is correct |
10 |
Correct |
4 ms |
804 KB |
Output is correct |
11 |
Correct |
3 ms |
604 KB |
Output is correct |
12 |
Correct |
3 ms |
600 KB |
Output is correct |
13 |
Correct |
3 ms |
604 KB |
Output is correct |
14 |
Correct |
3 ms |
604 KB |
Output is correct |
15 |
Correct |
3 ms |
604 KB |
Output is correct |
16 |
Correct |
4 ms |
604 KB |
Output is correct |
17 |
Correct |
3 ms |
604 KB |
Output is correct |
18 |
Correct |
5 ms |
604 KB |
Output is correct |
19 |
Correct |
2 ms |
604 KB |
Output is correct |
20 |
Incorrect |
4 ms |
604 KB |
Output isn't correct |
21 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
604 KB |
Output is correct |
2 |
Execution timed out |
2092 ms |
1372 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
600 KB |
Output is correct |
2 |
Correct |
4 ms |
604 KB |
Output is correct |
3 |
Correct |
3 ms |
604 KB |
Output is correct |
4 |
Correct |
1279 ms |
824 KB |
Output is correct |
5 |
Correct |
1303 ms |
600 KB |
Output is correct |
6 |
Correct |
1342 ms |
604 KB |
Output is correct |
7 |
Correct |
1313 ms |
600 KB |
Output is correct |
8 |
Correct |
1290 ms |
604 KB |
Output is correct |
9 |
Correct |
12 ms |
600 KB |
Output is correct |
10 |
Correct |
14 ms |
604 KB |
Output is correct |
11 |
Correct |
12 ms |
808 KB |
Output is correct |
12 |
Correct |
16 ms |
812 KB |
Output is correct |
13 |
Correct |
16 ms |
600 KB |
Output is correct |
14 |
Correct |
15 ms |
604 KB |
Output is correct |
15 |
Correct |
3 ms |
600 KB |
Output is correct |
16 |
Correct |
1321 ms |
820 KB |
Output is correct |
17 |
Correct |
1297 ms |
600 KB |
Output is correct |
18 |
Correct |
1300 ms |
788 KB |
Output is correct |
19 |
Correct |
1344 ms |
604 KB |
Output is correct |
20 |
Correct |
1357 ms |
604 KB |
Output is correct |
21 |
Correct |
1280 ms |
600 KB |
Output is correct |
22 |
Correct |
1326 ms |
604 KB |
Output is correct |
23 |
Correct |
914 ms |
1108 KB |
Output is correct |
24 |
Correct |
911 ms |
1116 KB |
Output is correct |
25 |
Correct |
895 ms |
860 KB |
Output is correct |
26 |
Correct |
931 ms |
1076 KB |
Output is correct |
27 |
Correct |
931 ms |
1016 KB |
Output is correct |
28 |
Correct |
941 ms |
912 KB |
Output is correct |
29 |
Correct |
938 ms |
860 KB |
Output is correct |
30 |
Correct |
917 ms |
1136 KB |
Output is correct |
31 |
Correct |
896 ms |
856 KB |
Output is correct |
32 |
Correct |
919 ms |
1116 KB |
Output is correct |
33 |
Correct |
773 ms |
860 KB |
Output is correct |
34 |
Correct |
815 ms |
856 KB |
Output is correct |
35 |
Correct |
799 ms |
924 KB |
Output is correct |
36 |
Correct |
819 ms |
856 KB |
Output is correct |
37 |
Correct |
805 ms |
1112 KB |
Output is correct |
38 |
Incorrect |
3 ms |
604 KB |
Output isn't correct |
39 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
600 KB |
Output is correct |
2 |
Correct |
3 ms |
600 KB |
Output is correct |
3 |
Correct |
3 ms |
604 KB |
Output is correct |
4 |
Correct |
3 ms |
808 KB |
Output is correct |
5 |
Correct |
3 ms |
604 KB |
Output is correct |
6 |
Correct |
3 ms |
600 KB |
Output is correct |
7 |
Correct |
3 ms |
804 KB |
Output is correct |
8 |
Correct |
4 ms |
604 KB |
Output is correct |
9 |
Correct |
3 ms |
600 KB |
Output is correct |
10 |
Correct |
4 ms |
804 KB |
Output is correct |
11 |
Correct |
3 ms |
604 KB |
Output is correct |
12 |
Correct |
3 ms |
600 KB |
Output is correct |
13 |
Correct |
3 ms |
604 KB |
Output is correct |
14 |
Correct |
3 ms |
604 KB |
Output is correct |
15 |
Correct |
3 ms |
604 KB |
Output is correct |
16 |
Correct |
4 ms |
604 KB |
Output is correct |
17 |
Correct |
3 ms |
604 KB |
Output is correct |
18 |
Correct |
5 ms |
604 KB |
Output is correct |
19 |
Correct |
2 ms |
604 KB |
Output is correct |
20 |
Incorrect |
4 ms |
604 KB |
Output isn't correct |
21 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
600 KB |
Output is correct |
2 |
Correct |
3 ms |
600 KB |
Output is correct |
3 |
Correct |
3 ms |
604 KB |
Output is correct |
4 |
Correct |
3 ms |
808 KB |
Output is correct |
5 |
Correct |
3 ms |
604 KB |
Output is correct |
6 |
Correct |
3 ms |
600 KB |
Output is correct |
7 |
Correct |
3 ms |
804 KB |
Output is correct |
8 |
Correct |
4 ms |
604 KB |
Output is correct |
9 |
Correct |
3 ms |
600 KB |
Output is correct |
10 |
Correct |
4 ms |
804 KB |
Output is correct |
11 |
Correct |
3 ms |
604 KB |
Output is correct |
12 |
Correct |
3 ms |
600 KB |
Output is correct |
13 |
Correct |
3 ms |
604 KB |
Output is correct |
14 |
Correct |
3 ms |
604 KB |
Output is correct |
15 |
Correct |
3 ms |
604 KB |
Output is correct |
16 |
Correct |
4 ms |
604 KB |
Output is correct |
17 |
Correct |
3 ms |
604 KB |
Output is correct |
18 |
Correct |
5 ms |
604 KB |
Output is correct |
19 |
Correct |
2 ms |
604 KB |
Output is correct |
20 |
Incorrect |
4 ms |
604 KB |
Output isn't correct |
21 |
Halted |
0 ms |
0 KB |
- |