# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
900485 | 2024-01-08T11:05:45 Z | qin | Cell Automaton (JOI23_cell) | C++17 | 13 ms | 1884 KB |
#include <bits/stdc++.h> #define fi first #define se second #define ssize(x) int(x.size()) #define pn printf("\n"); using namespace std; typedef long long ll; typedef pair<int, int> pii; int inf = 2e09; ll infll = 2e18; int mod = 119<<23|1; void answer(){ int n, q; scanf("%d%d", &n, &q); vector<vector<int>> t(300, vector<int>(300, 0)), templat = t, tmp; int x, y; for(int i = 1; i <= n; ++i) scanf("%d%d", &x, &y), x += 100, y += 100, t[x][y] = 2; vector<int> result(51); result[0] = n; for(int T = 1; T <= 50; ++T){ tmp = templat; int cnt = 0; for(int i = 1; i < 300-1; ++i) for(int j = 1; j < 300-1; ++j) if(!t[i][j] && (t[i+1][j]==2 || t[i-1][j]==2 || t[i][j+1]==2 || t[i][j-1]==2)) tmp[i][j] = 2, ++cnt; else if(t[i][j] == 1) tmp[i][j] = 0; else if(t[i][j] == 2) tmp[i][j] = 1; t = tmp; //~ for(int i = 80; i < 120; ++i){ //~ for(int j = 80; j < 120; ++j) if(t[i][j] == 2) printf("#"); //~ else if(t[i][j] == 1) printf("."); //~ else printf(" "); //~ pn; //~ } //~ usleep(300000); //~ for(int i = 0; i < 4; ++i) pn; result[T] = cnt; } for(++q; --q; ){ int T; scanf("%d", &T); printf("%d\n", result[T]); } } signed main(){ int T = 1; for(++T; --T; ) answer(); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 1504 KB | Output is correct |
2 | Correct | 8 ms | 1372 KB | Output is correct |
3 | Correct | 9 ms | 1372 KB | Output is correct |
4 | Correct | 8 ms | 1372 KB | Output is correct |
5 | Correct | 8 ms | 1528 KB | Output is correct |
6 | Correct | 8 ms | 1368 KB | Output is correct |
7 | Correct | 8 ms | 1508 KB | Output is correct |
8 | Correct | 9 ms | 1372 KB | Output is correct |
9 | Correct | 9 ms | 1372 KB | Output is correct |
10 | Correct | 13 ms | 1372 KB | Output is correct |
11 | Correct | 8 ms | 1524 KB | Output is correct |
12 | Correct | 9 ms | 1372 KB | Output is correct |
13 | Correct | 9 ms | 1372 KB | Output is correct |
14 | Correct | 12 ms | 1532 KB | Output is correct |
15 | Correct | 8 ms | 1372 KB | Output is correct |
16 | Correct | 10 ms | 1476 KB | Output is correct |
17 | Correct | 9 ms | 1372 KB | Output is correct |
18 | Correct | 8 ms | 1372 KB | Output is correct |
19 | Correct | 8 ms | 1368 KB | Output is correct |
20 | Correct | 8 ms | 1536 KB | Output is correct |
21 | Correct | 8 ms | 1432 KB | Output is correct |
22 | Correct | 8 ms | 1624 KB | Output is correct |
23 | Correct | 8 ms | 1372 KB | Output is correct |
24 | Correct | 10 ms | 1372 KB | Output is correct |
25 | Correct | 8 ms | 1372 KB | Output is correct |
26 | Correct | 8 ms | 1372 KB | Output is correct |
27 | Correct | 8 ms | 1624 KB | Output is correct |
28 | Correct | 8 ms | 1372 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 1504 KB | Output is correct |
2 | Correct | 8 ms | 1372 KB | Output is correct |
3 | Correct | 9 ms | 1372 KB | Output is correct |
4 | Correct | 8 ms | 1372 KB | Output is correct |
5 | Correct | 8 ms | 1528 KB | Output is correct |
6 | Correct | 8 ms | 1368 KB | Output is correct |
7 | Correct | 8 ms | 1508 KB | Output is correct |
8 | Correct | 9 ms | 1372 KB | Output is correct |
9 | Correct | 9 ms | 1372 KB | Output is correct |
10 | Correct | 13 ms | 1372 KB | Output is correct |
11 | Correct | 8 ms | 1524 KB | Output is correct |
12 | Correct | 9 ms | 1372 KB | Output is correct |
13 | Correct | 9 ms | 1372 KB | Output is correct |
14 | Correct | 12 ms | 1532 KB | Output is correct |
15 | Correct | 8 ms | 1372 KB | Output is correct |
16 | Correct | 10 ms | 1476 KB | Output is correct |
17 | Correct | 9 ms | 1372 KB | Output is correct |
18 | Correct | 8 ms | 1372 KB | Output is correct |
19 | Correct | 8 ms | 1368 KB | Output is correct |
20 | Correct | 8 ms | 1536 KB | Output is correct |
21 | Correct | 8 ms | 1432 KB | Output is correct |
22 | Correct | 8 ms | 1624 KB | Output is correct |
23 | Correct | 8 ms | 1372 KB | Output is correct |
24 | Correct | 10 ms | 1372 KB | Output is correct |
25 | Correct | 8 ms | 1372 KB | Output is correct |
26 | Correct | 8 ms | 1372 KB | Output is correct |
27 | Correct | 8 ms | 1624 KB | Output is correct |
28 | Correct | 8 ms | 1372 KB | Output is correct |
29 | Incorrect | 9 ms | 1372 KB | Output isn't correct |
30 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 1880 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 1880 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 1884 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 1884 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 1504 KB | Output is correct |
2 | Correct | 8 ms | 1372 KB | Output is correct |
3 | Correct | 9 ms | 1372 KB | Output is correct |
4 | Correct | 8 ms | 1372 KB | Output is correct |
5 | Correct | 8 ms | 1528 KB | Output is correct |
6 | Correct | 8 ms | 1368 KB | Output is correct |
7 | Correct | 8 ms | 1508 KB | Output is correct |
8 | Correct | 9 ms | 1372 KB | Output is correct |
9 | Correct | 9 ms | 1372 KB | Output is correct |
10 | Correct | 13 ms | 1372 KB | Output is correct |
11 | Correct | 8 ms | 1524 KB | Output is correct |
12 | Correct | 9 ms | 1372 KB | Output is correct |
13 | Correct | 9 ms | 1372 KB | Output is correct |
14 | Correct | 12 ms | 1532 KB | Output is correct |
15 | Correct | 8 ms | 1372 KB | Output is correct |
16 | Correct | 10 ms | 1476 KB | Output is correct |
17 | Correct | 9 ms | 1372 KB | Output is correct |
18 | Correct | 8 ms | 1372 KB | Output is correct |
19 | Correct | 8 ms | 1368 KB | Output is correct |
20 | Correct | 8 ms | 1536 KB | Output is correct |
21 | Correct | 8 ms | 1432 KB | Output is correct |
22 | Correct | 8 ms | 1624 KB | Output is correct |
23 | Correct | 8 ms | 1372 KB | Output is correct |
24 | Correct | 10 ms | 1372 KB | Output is correct |
25 | Correct | 8 ms | 1372 KB | Output is correct |
26 | Correct | 8 ms | 1372 KB | Output is correct |
27 | Correct | 8 ms | 1624 KB | Output is correct |
28 | Correct | 8 ms | 1372 KB | Output is correct |
29 | Incorrect | 9 ms | 1372 KB | Output isn't correct |
30 | Halted | 0 ms | 0 KB | - |