Submission #200894

#TimeUsernameProblemLanguageResultExecution timeMemory
200894SamAndTetris (COCI17_tetris)C++17
80 / 80
5 ms376 KiB
#include <bits/stdc++.h> using namespace std; const int N = 12, K = 11; const int nn[K] = {2, 1, 4, 2, 3, 2, 3, 2, 3, 2, 3}; const int mm[K] = {2, 4, 1, 3, 2, 3, 2, 3, 2, 3, 2}; const pair<int, int> f[K][N] = { {{0, 0}, {0, 1}, {1, 0}, {1, 1}}, {{0, 0}, {0, 1}, {0, 2}, {0, 3}}, {{0, 0}, {1, 0}, {2, 0}, {3, 0}}, {{0, 1}, {0, 2}, {1, 0}, {1, 1}}, {{0, 0}, {1, 0}, {1, 1}, {2, 1}}, {{0, 0}, {0, 1}, {1, 1}, {1, 2}}, {{0, 1}, {1, 0}, {1, 1}, {2, 0}}, {{0, 1}, {1, 0}, {1, 1}, {1, 2}}, {{0, 0}, {1, 0}, {1, 1}, {2, 0}}, {{0, 0}, {0, 1}, {0, 2}, {1, 1}}, {{0, 1}, {1, 0}, {1, 1}, {2, 1}} }; int n, m; char a[N][N]; int q[K]; int main() { scanf("%d%d", &n, &m); for (int i = 0; i < n; ++i) { scanf(" %s", a[i]); } for (int u = 0; u < K; ++u) { for (int x = 0; x < n - nn[u] + 1; ++x) { for (int y = 0; y < m - mm[u] + 1; ++y) { bool z = true; for (int i = 0; i < 4; ++i) { int hx = x + f[u][i].first; int hy = y + f[u][i].second; if (a[hx][hy] == '.') { z = false; break; } if (a[hx][hy] != a[x + f[u][0].first][y + f[u][0].second]) { z = false; break; } } if (z) ++q[u]; } } } printf("%d\n", q[0]); printf("%d\n", q[1] + q[2]); printf("%d\n", q[3] + q[4]); printf("%d\n", q[5] + q[6]); printf("%d\n", q[7] + q[8] + q[9] + q[10]); return 0; }

Compilation message (stderr)

tetris.cpp: In function 'int main()':
tetris.cpp:28:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d", &n, &m);
     ~~~~~^~~~~~~~~~~~~~~~
tetris.cpp:31:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf(" %s", a[i]);
         ~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...