# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1045606 | 2024-08-06T06:16:48 Z | 15분 56초! 15분 57초!(#11072) | Cell Automaton (JOI23_cell) | C++17 | 153 ms | 127776 KB |
#include <bits/stdc++.h> using namespace std; int n,qr; typedef pair<int,int> P; typedef pair<int,P> iP; P arr[100000]; int dist[4005][4005]; const int zero=2000; int dx[4]={1,0,-1,0}; int dy[4]={0,1,0,-1}; int save[1005]; int main() { scanf("%d %d",&n,&qr); queue<P> q; memset(dist,-1,sizeof(dist)); for(int i=0;i<n;i++) { int x,y; scanf("%d %d",&x,&y); q.push(P(zero+x,zero+y)); dist[zero+x][zero+y]=0; } while (!q.empty()) { P now=q.front(); q.pop(); if (dist[now.first][now.second]>=1000) { continue; } for(int k=0;k<4;k++) { int x=now.first+dx[k]; int y=now.second+dy[k]; if (dist[x][y]==-1) { dist[x][y]=dist[now.first][now.second]+1; q.push(P(x,y)); } } } for(int i=0;i<4005;i++) { for(int j=0;j<4005;j++) { if (dist[i][j]!=-1) { save[dist[i][j]]++; } } } for(int i=0;i<qr;i++) { int t; scanf("%d",&t); printf("%d\n",save[t]); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 41 ms | 63236 KB | Output is correct |
2 | Correct | 40 ms | 63232 KB | Output is correct |
3 | Correct | 45 ms | 63260 KB | Output is correct |
4 | Correct | 49 ms | 63064 KB | Output is correct |
5 | Correct | 44 ms | 63064 KB | Output is correct |
6 | Correct | 42 ms | 63068 KB | Output is correct |
7 | Correct | 41 ms | 63064 KB | Output is correct |
8 | Correct | 44 ms | 63324 KB | Output is correct |
9 | Correct | 43 ms | 63064 KB | Output is correct |
10 | Correct | 42 ms | 63068 KB | Output is correct |
11 | Correct | 43 ms | 63252 KB | Output is correct |
12 | Correct | 42 ms | 63320 KB | Output is correct |
13 | Correct | 44 ms | 63068 KB | Output is correct |
14 | Correct | 43 ms | 63064 KB | Output is correct |
15 | Correct | 42 ms | 63064 KB | Output is correct |
16 | Correct | 39 ms | 63068 KB | Output is correct |
17 | Correct | 43 ms | 63068 KB | Output is correct |
18 | Correct | 38 ms | 63184 KB | Output is correct |
19 | Correct | 40 ms | 63064 KB | Output is correct |
20 | Correct | 40 ms | 63068 KB | Output is correct |
21 | Correct | 39 ms | 63064 KB | Output is correct |
22 | Correct | 38 ms | 63068 KB | Output is correct |
23 | Correct | 38 ms | 63068 KB | Output is correct |
24 | Correct | 41 ms | 63068 KB | Output is correct |
25 | Correct | 39 ms | 63068 KB | Output is correct |
26 | Correct | 43 ms | 63064 KB | Output is correct |
27 | Correct | 53 ms | 63068 KB | Output is correct |
28 | Correct | 41 ms | 63068 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 41 ms | 63236 KB | Output is correct |
2 | Correct | 40 ms | 63232 KB | Output is correct |
3 | Correct | 45 ms | 63260 KB | Output is correct |
4 | Correct | 49 ms | 63064 KB | Output is correct |
5 | Correct | 44 ms | 63064 KB | Output is correct |
6 | Correct | 42 ms | 63068 KB | Output is correct |
7 | Correct | 41 ms | 63064 KB | Output is correct |
8 | Correct | 44 ms | 63324 KB | Output is correct |
9 | Correct | 43 ms | 63064 KB | Output is correct |
10 | Correct | 42 ms | 63068 KB | Output is correct |
11 | Correct | 43 ms | 63252 KB | Output is correct |
12 | Correct | 42 ms | 63320 KB | Output is correct |
13 | Correct | 44 ms | 63068 KB | Output is correct |
14 | Correct | 43 ms | 63064 KB | Output is correct |
15 | Correct | 42 ms | 63064 KB | Output is correct |
16 | Correct | 39 ms | 63068 KB | Output is correct |
17 | Correct | 43 ms | 63068 KB | Output is correct |
18 | Correct | 38 ms | 63184 KB | Output is correct |
19 | Correct | 40 ms | 63064 KB | Output is correct |
20 | Correct | 40 ms | 63068 KB | Output is correct |
21 | Correct | 39 ms | 63064 KB | Output is correct |
22 | Correct | 38 ms | 63068 KB | Output is correct |
23 | Correct | 38 ms | 63068 KB | Output is correct |
24 | Correct | 41 ms | 63068 KB | Output is correct |
25 | Correct | 39 ms | 63068 KB | Output is correct |
26 | Correct | 43 ms | 63064 KB | Output is correct |
27 | Correct | 53 ms | 63068 KB | Output is correct |
28 | Correct | 41 ms | 63068 KB | Output is correct |
29 | Correct | 44 ms | 63068 KB | Output is correct |
30 | Correct | 52 ms | 63064 KB | Output is correct |
31 | Correct | 82 ms | 63312 KB | Output is correct |
32 | Correct | 130 ms | 66492 KB | Output is correct |
33 | Correct | 57 ms | 63064 KB | Output is correct |
34 | Correct | 85 ms | 63064 KB | Output is correct |
35 | Correct | 65 ms | 63112 KB | Output is correct |
36 | Correct | 41 ms | 63068 KB | Output is correct |
37 | Correct | 38 ms | 63064 KB | Output is correct |
38 | Correct | 108 ms | 63320 KB | Output is correct |
39 | Correct | 109 ms | 64092 KB | Output is correct |
40 | Correct | 153 ms | 66944 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 50 ms | 127696 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 50 ms | 127696 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 44 ms | 127776 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 44 ms | 127776 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 41 ms | 63236 KB | Output is correct |
2 | Correct | 40 ms | 63232 KB | Output is correct |
3 | Correct | 45 ms | 63260 KB | Output is correct |
4 | Correct | 49 ms | 63064 KB | Output is correct |
5 | Correct | 44 ms | 63064 KB | Output is correct |
6 | Correct | 42 ms | 63068 KB | Output is correct |
7 | Correct | 41 ms | 63064 KB | Output is correct |
8 | Correct | 44 ms | 63324 KB | Output is correct |
9 | Correct | 43 ms | 63064 KB | Output is correct |
10 | Correct | 42 ms | 63068 KB | Output is correct |
11 | Correct | 43 ms | 63252 KB | Output is correct |
12 | Correct | 42 ms | 63320 KB | Output is correct |
13 | Correct | 44 ms | 63068 KB | Output is correct |
14 | Correct | 43 ms | 63064 KB | Output is correct |
15 | Correct | 42 ms | 63064 KB | Output is correct |
16 | Correct | 39 ms | 63068 KB | Output is correct |
17 | Correct | 43 ms | 63068 KB | Output is correct |
18 | Correct | 38 ms | 63184 KB | Output is correct |
19 | Correct | 40 ms | 63064 KB | Output is correct |
20 | Correct | 40 ms | 63068 KB | Output is correct |
21 | Correct | 39 ms | 63064 KB | Output is correct |
22 | Correct | 38 ms | 63068 KB | Output is correct |
23 | Correct | 38 ms | 63068 KB | Output is correct |
24 | Correct | 41 ms | 63068 KB | Output is correct |
25 | Correct | 39 ms | 63068 KB | Output is correct |
26 | Correct | 43 ms | 63064 KB | Output is correct |
27 | Correct | 53 ms | 63068 KB | Output is correct |
28 | Correct | 41 ms | 63068 KB | Output is correct |
29 | Correct | 44 ms | 63068 KB | Output is correct |
30 | Correct | 52 ms | 63064 KB | Output is correct |
31 | Correct | 82 ms | 63312 KB | Output is correct |
32 | Correct | 130 ms | 66492 KB | Output is correct |
33 | Correct | 57 ms | 63064 KB | Output is correct |
34 | Correct | 85 ms | 63064 KB | Output is correct |
35 | Correct | 65 ms | 63112 KB | Output is correct |
36 | Correct | 41 ms | 63068 KB | Output is correct |
37 | Correct | 38 ms | 63064 KB | Output is correct |
38 | Correct | 108 ms | 63320 KB | Output is correct |
39 | Correct | 109 ms | 64092 KB | Output is correct |
40 | Correct | 153 ms | 66944 KB | Output is correct |
41 | Runtime error | 50 ms | 127696 KB | Execution killed with signal 11 |
42 | Halted | 0 ms | 0 KB | - |