Submission #469964

#TimeUsernameProblemLanguageResultExecution timeMemory
469964rainboyTetris (COCI17_tetris)C11
80 / 80
1 ms272 KiB
#include <stdio.h> #define N 10 #define M 10 int dij[][3][2] = { { { 0, 1 }, { 1, 0 }, { 1, 1 } }, { { 0, 1 }, { 0, 2 }, { 0, 3 } }, { { 0, 1 }, { 1, 0 }, { 1, -1 } }, { { 0, -1 }, { 1, 0 }, { 1, 1 } }, { { -1, 0 }, { 0, -1 }, { 0, 1 } }, }; int rr[] = { 1, 2, 2, 2, 4 }; int main() { static char cc[N][M + 1]; int n, m, t, r, h, i, j, k; scanf("%d%d", &n, &m); for (i = 0; i < n; i++) scanf("%s", cc[i]); for (t = 0; t < 5; t++) { k = 0; for (r = 0; r < rr[t]; r++) for (i = 0; i < n; i++) for (j = 0; j < m; j++) { int good; if (cc[i][j] == '.') continue; good = 1; for (h = 0; h < 3; h++) { int i_, j_; if (r == 0) i_ = i + dij[t][h][0], j_ = j + dij[t][h][1]; else if (r == 1) i_ = i - dij[t][h][1], j_ = j + dij[t][h][0]; else if (r == 2) i_ = i - dij[t][h][0], j_ = j - dij[t][h][1]; else i_ = i + dij[t][h][1], j_ = j - dij[t][h][0]; if (i_ < 0 || i_ >= n || j_ < 0 || j_ >= m || cc[i_][j_] != cc[i][j]) { good = 0; break; } } if (good) k++; } printf("%d\n", k); } return 0; }

Compilation message (stderr)

tetris.c: In function 'main':
tetris.c:20:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |  scanf("%d%d", &n, &m);
      |  ^~~~~~~~~~~~~~~~~~~~~
tetris.c:22:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |   scanf("%s", cc[i]);
      |   ^~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...