# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
813359 | 2023-08-07T16:19:52 Z | arnold518 | Cell Automaton (JOI23_cell) | C++17 | 225 ms | 43952 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int MAXN = 1e5; const int MAXM = 5e5; int N, M; pii A[MAXN+10]; int B[MAXM+10]; int P[4010][4010]; const int dy[]={-1, 1, 0, 0}; const int dx[]={0, 0, -1, 1}; int ans[1010]; int main() { scanf("%d%d", &N, &M); for(int i=1; i<=N; i++) scanf("%d%d", &A[i].first, &A[i].second); for(int i=1; i<=M; i++) scanf("%d", &B[i]); queue<pii> Q; for(int i=1; i<=N; i++) { P[A[i].first+2000][A[i].second+2000]=1; Q.push({A[i].first+2000, A[i].second+2000}); } while(!Q.empty()) { pii now=Q.front(); Q.pop(); ans[P[now.first][now.second]-1]++; if(P[now.first][now.second]>B[M]+1) continue; for(int i=0; i<4; i++) { int ny=now.first+dy[i], nx=now.second+dx[i]; if(P[ny][nx]) continue; P[ny][nx]=P[now.first][now.second]+1; Q.push({ny, nx}); } } for(int i=1; i<=M; i++) printf("%d\n", ans[B[i]]); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 724 KB | Output is correct |
2 | Correct | 1 ms | 852 KB | Output is correct |
3 | Correct | 1 ms | 1108 KB | Output is correct |
4 | Correct | 1 ms | 1236 KB | Output is correct |
5 | Correct | 1 ms | 852 KB | Output is correct |
6 | Correct | 1 ms | 980 KB | Output is correct |
7 | Correct | 1 ms | 1108 KB | Output is correct |
8 | Correct | 3 ms | 1344 KB | Output is correct |
9 | Correct | 1 ms | 1236 KB | Output is correct |
10 | Correct | 1 ms | 1236 KB | Output is correct |
11 | Correct | 1 ms | 1236 KB | Output is correct |
12 | Correct | 1 ms | 1236 KB | Output is correct |
13 | Correct | 1 ms | 1236 KB | Output is correct |
14 | Correct | 1 ms | 1236 KB | Output is correct |
15 | Correct | 1 ms | 1236 KB | Output is correct |
16 | Correct | 1 ms | 724 KB | Output is correct |
17 | Correct | 1 ms | 724 KB | Output is correct |
18 | Correct | 1 ms | 724 KB | Output is correct |
19 | Correct | 1 ms | 724 KB | Output is correct |
20 | Correct | 1 ms | 724 KB | Output is correct |
21 | Correct | 1 ms | 724 KB | Output is correct |
22 | Correct | 1 ms | 724 KB | Output is correct |
23 | Correct | 1 ms | 724 KB | Output is correct |
24 | Correct | 1 ms | 724 KB | Output is correct |
25 | Correct | 1 ms | 724 KB | Output is correct |
26 | Correct | 1 ms | 724 KB | Output is correct |
27 | Correct | 1 ms | 724 KB | Output is correct |
28 | Correct | 1 ms | 724 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 724 KB | Output is correct |
2 | Correct | 1 ms | 852 KB | Output is correct |
3 | Correct | 1 ms | 1108 KB | Output is correct |
4 | Correct | 1 ms | 1236 KB | Output is correct |
5 | Correct | 1 ms | 852 KB | Output is correct |
6 | Correct | 1 ms | 980 KB | Output is correct |
7 | Correct | 1 ms | 1108 KB | Output is correct |
8 | Correct | 3 ms | 1344 KB | Output is correct |
9 | Correct | 1 ms | 1236 KB | Output is correct |
10 | Correct | 1 ms | 1236 KB | Output is correct |
11 | Correct | 1 ms | 1236 KB | Output is correct |
12 | Correct | 1 ms | 1236 KB | Output is correct |
13 | Correct | 1 ms | 1236 KB | Output is correct |
14 | Correct | 1 ms | 1236 KB | Output is correct |
15 | Correct | 1 ms | 1236 KB | Output is correct |
16 | Correct | 1 ms | 724 KB | Output is correct |
17 | Correct | 1 ms | 724 KB | Output is correct |
18 | Correct | 1 ms | 724 KB | Output is correct |
19 | Correct | 1 ms | 724 KB | Output is correct |
20 | Correct | 1 ms | 724 KB | Output is correct |
21 | Correct | 1 ms | 724 KB | Output is correct |
22 | Correct | 1 ms | 724 KB | Output is correct |
23 | Correct | 1 ms | 724 KB | Output is correct |
24 | Correct | 1 ms | 724 KB | Output is correct |
25 | Correct | 1 ms | 724 KB | Output is correct |
26 | Correct | 1 ms | 724 KB | Output is correct |
27 | Correct | 1 ms | 724 KB | Output is correct |
28 | Correct | 1 ms | 724 KB | Output is correct |
29 | Correct | 58 ms | 16568 KB | Output is correct |
30 | Correct | 94 ms | 23056 KB | Output is correct |
31 | Correct | 195 ms | 32772 KB | Output is correct |
32 | Correct | 221 ms | 43092 KB | Output is correct |
33 | Correct | 97 ms | 24136 KB | Output is correct |
34 | Correct | 138 ms | 27832 KB | Output is correct |
35 | Correct | 124 ms | 28048 KB | Output is correct |
36 | Correct | 11 ms | 6228 KB | Output is correct |
37 | Correct | 10 ms | 6280 KB | Output is correct |
38 | Correct | 209 ms | 39112 KB | Output is correct |
39 | Correct | 205 ms | 40624 KB | Output is correct |
40 | Correct | 225 ms | 43952 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 19 ms | 2124 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 19 ms | 2124 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 468 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 468 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 724 KB | Output is correct |
2 | Correct | 1 ms | 852 KB | Output is correct |
3 | Correct | 1 ms | 1108 KB | Output is correct |
4 | Correct | 1 ms | 1236 KB | Output is correct |
5 | Correct | 1 ms | 852 KB | Output is correct |
6 | Correct | 1 ms | 980 KB | Output is correct |
7 | Correct | 1 ms | 1108 KB | Output is correct |
8 | Correct | 3 ms | 1344 KB | Output is correct |
9 | Correct | 1 ms | 1236 KB | Output is correct |
10 | Correct | 1 ms | 1236 KB | Output is correct |
11 | Correct | 1 ms | 1236 KB | Output is correct |
12 | Correct | 1 ms | 1236 KB | Output is correct |
13 | Correct | 1 ms | 1236 KB | Output is correct |
14 | Correct | 1 ms | 1236 KB | Output is correct |
15 | Correct | 1 ms | 1236 KB | Output is correct |
16 | Correct | 1 ms | 724 KB | Output is correct |
17 | Correct | 1 ms | 724 KB | Output is correct |
18 | Correct | 1 ms | 724 KB | Output is correct |
19 | Correct | 1 ms | 724 KB | Output is correct |
20 | Correct | 1 ms | 724 KB | Output is correct |
21 | Correct | 1 ms | 724 KB | Output is correct |
22 | Correct | 1 ms | 724 KB | Output is correct |
23 | Correct | 1 ms | 724 KB | Output is correct |
24 | Correct | 1 ms | 724 KB | Output is correct |
25 | Correct | 1 ms | 724 KB | Output is correct |
26 | Correct | 1 ms | 724 KB | Output is correct |
27 | Correct | 1 ms | 724 KB | Output is correct |
28 | Correct | 1 ms | 724 KB | Output is correct |
29 | Correct | 58 ms | 16568 KB | Output is correct |
30 | Correct | 94 ms | 23056 KB | Output is correct |
31 | Correct | 195 ms | 32772 KB | Output is correct |
32 | Correct | 221 ms | 43092 KB | Output is correct |
33 | Correct | 97 ms | 24136 KB | Output is correct |
34 | Correct | 138 ms | 27832 KB | Output is correct |
35 | Correct | 124 ms | 28048 KB | Output is correct |
36 | Correct | 11 ms | 6228 KB | Output is correct |
37 | Correct | 10 ms | 6280 KB | Output is correct |
38 | Correct | 209 ms | 39112 KB | Output is correct |
39 | Correct | 205 ms | 40624 KB | Output is correct |
40 | Correct | 225 ms | 43952 KB | Output is correct |
41 | Runtime error | 19 ms | 2124 KB | Execution killed with signal 11 |
42 | Halted | 0 ms | 0 KB | - |