# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
53375 | 2018-06-29T15:30:42 Z | kriii | 즐거운 사진 수집 (JOI13_collecting) | C++17 | 1558 ms | 267180 KB |
#include <stdio.h> const int Z = 1<<20; int N,M,B[2][Z*2]; long long base,C[2][20]; void in(int k, int x) { x += Z; B[k][x] = 3 - B[k][x]; x /= 2; int l = 0; while (x){ if (B[k][x] != 3) C[k][l]--; B[k][x] = B[k][x*2] | B[k][x*2+1]; if (B[k][x] != 3) C[k][l]++; x /= 2; l++; } } int main() { scanf ("%d %d",&N,&M); for (int i=0;i<=N;i++) base += 1ll << (2 * i); for (int k=0;k<2;k++){ for (int i=0;i<Z*2;i++) B[k][i] = 1; for (int i=0;i<N;i++) C[k][i] = (1 << (N - i - 1)); } while (M--){ int k,x; scanf ("%d %d",&k,&x); x--; in(k,x); long long ans = base; for (int i=0;i<N;i++) ans -= C[0][i] * C[1][i] * 4; printf ("%lld\n",ans); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 19 ms | 16760 KB | Output is correct |
2 | Correct | 14 ms | 16832 KB | Output is correct |
3 | Correct | 17 ms | 16988 KB | Output is correct |
4 | Correct | 15 ms | 16988 KB | Output is correct |
5 | Correct | 18 ms | 16988 KB | Output is correct |
6 | Correct | 15 ms | 16988 KB | Output is correct |
7 | Correct | 18 ms | 17016 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 16 ms | 17144 KB | Output is correct |
2 | Correct | 16 ms | 17144 KB | Output is correct |
3 | Correct | 20 ms | 17200 KB | Output is correct |
4 | Correct | 21 ms | 17200 KB | Output is correct |
5 | Correct | 21 ms | 17200 KB | Output is correct |
6 | Correct | 19 ms | 17200 KB | Output is correct |
7 | Correct | 18 ms | 17268 KB | Output is correct |
8 | Correct | 15 ms | 17276 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1392 ms | 61504 KB | Output is correct |
2 | Correct | 1383 ms | 79012 KB | Output is correct |
3 | Correct | 1179 ms | 93656 KB | Output is correct |
4 | Correct | 1558 ms | 113500 KB | Output is correct |
5 | Correct | 1370 ms | 130620 KB | Output is correct |
6 | Correct | 1468 ms | 147116 KB | Output is correct |
7 | Correct | 1403 ms | 165808 KB | Output is correct |
8 | Correct | 1430 ms | 183176 KB | Output is correct |
9 | Correct | 1482 ms | 196640 KB | Output is correct |
10 | Correct | 1540 ms | 215388 KB | Output is correct |
11 | Correct | 1485 ms | 232992 KB | Output is correct |
12 | Correct | 1518 ms | 250040 KB | Output is correct |
13 | Correct | 1338 ms | 267180 KB | Output is correct |