Submission #525430

#TimeUsernameProblemLanguageResultExecution timeMemory
525430rainboy즐거운 사진 수집 (JOI13_collecting)C11
30 / 100
2225 ms66920 KiB
#include <stdio.h> #define N 10 #define N_ (1 << N) int cc[N_ * 2][N_ * 2], sz[N_ * 2][N_ * 2], n_; void pul(int i, int j) { int il = i << 1, ir = i << 1 | 1; int jl = j << 1, jr = j << 1 | 1; if (cc[il][jl] == -1 || cc[il][jr] == -1 || cc[ir][jl] == -1 || cc[ir][jr] == -1 || cc[il][jr] != cc[il][jl] || cc[ir][jl] != cc[il][jl] || cc[ir][jr] != cc[il][jl]) cc[i][j] = -1, sz[i][j] = 1 + sz[il][jl] + sz[il][jr] + sz[ir][jl] + sz[ir][jr]; else cc[i][j] = cc[il][jl], sz[i][j] = 1; } void update(int i, int j) { i += n_, j += n_; cc[i][j] ^= 1, sz[i][j] = 1; while (i > 1 && j > 1) pul(i >>= 1, j >>= 1); } int main() { int n, q, i, j; scanf("%d%d", &n, &q), n_ = 1 << n; for (i = 0; i < n_ * 2; i++) for (j = 0; j < n_ * 2; j++) cc[i][j] = 0, sz[i][j] = 1; while (q--) { int t; scanf("%d", &t); if (t == 0) { scanf("%d", &i), i--; for (j = 0; j < n_; j++) update(i, j); } else { scanf("%d", &j), j--; for (i = 0; i < n_; i++) update(i, j); } printf("%d\n", sz[1][1]); } return 0; }

Compilation message (stderr)

collecting.c: In function 'main':
collecting.c:28:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   28 |  scanf("%d%d", &n, &q), n_ = 1 << n;
      |  ^~~~~~~~~~~~~~~~~~~~~
collecting.c:35:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   35 |   scanf("%d", &t);
      |   ^~~~~~~~~~~~~~~
collecting.c:37:4: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   37 |    scanf("%d", &i), i--;
      |    ^~~~~~~~~~~~~~~
collecting.c:41:4: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   41 |    scanf("%d", &j), j--;
      |    ^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...