# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
44581 | 2018-04-03T12:28:00 Z | heon | Tetris (COCI17_tetris) | C++11 | 2 ms | 584 KB |
#include<stdio.h> int main() { int n, m; int fig1 = 0, fig2 = 0, fig3 = 0, fig4 = 0, fig5 = 0; scanf("%d %d", &n, &m); char niz[10][10]; for (int i = 0; i < n; i++) { scanf("%s", &niz[i]); } for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { if (niz[i][j] == '.') { continue; } if (i + 1 < n && j+1 < m && niz[i][j] == niz[i + 1][j] && niz[i][j] == niz[i][j + 1] && niz[i][j] == niz[i + 1][j + 1]) { fig1++; } if (i + 3 < n && niz[i][j] == niz[i + 1][j] && niz[i][j] == niz[i + 2][j] && niz[i][j] == niz[i + 3][j] && niz[i][j] == niz[i + 4][j]) { fig2++; } if (j + 3 < m && niz[i][j] == niz[i][j + 1] && niz[i][j] == niz[i][j + 2] && niz[i][j] == niz[i][j + 3] && niz[i][j] == niz[i][j + 4]) { fig2++; } if (i + 2 < n && j + 1 < m && niz[i][j] == niz[i + 1][j] && niz[i][j] == niz[i - 1][j + 1] && niz[i][j] == niz[i][j + 1]) { fig3++; } if (i + 1 < n && j + 1 < m && j > 0 && niz[i][j] == niz[i + 1][j] && niz[i][j] == niz[i][j + 1] && niz[i][j] == niz[i + 1][j - 1]) { fig3++; } if (i + 2 < n && j + 1 < m && niz[i][j] == niz[i + 1][j] && niz[i][j] == niz[i + 1][j + 1] && niz[i][j] == niz[i + 2][j + 1]) { fig4++; } if (i + 2 < n && j + 2 < m && niz[i][j] == niz[i + 1][j - 1] && niz[i][j] == niz[i + 1][j] && niz[i][j] == niz[i][j + 1]) { fig4++; } if (i+2 < n && j > 0 && niz[i+1][j-1] == niz[i][j] && niz[i+1][j] == niz[i][j] && niz[i+2][j] == niz[i][j]) { fig5++; } if (i+1 < n && j > 0 && j+1 < m && niz[i][j] == niz[i - 1][j] && niz[i][j] == niz[i + 1][j] && niz[i][j] == niz[i][j - 1]) { fig5++; } if (i+1 < n && j+2 < m && niz[i][j] == niz[i + 1][j] && niz[i][j] == niz[i][j - 1] && niz[i][j] == niz[i][j + 1]) { fig5++; } if (i+1 < n && j+2 < m && niz[i][j] == niz[i - 1][j] && niz[i][j] == niz[i + 1][j] && niz[i][j] == niz[i][j - 1]) { fig5++; } } } printf("%d\n%d\n%d\n%d\n%d\n", fig1, fig2, fig3, fig4, fig5); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 496 KB | Output is correct |
3 | Incorrect | 2 ms | 496 KB | Output isn't correct |
4 | Incorrect | 2 ms | 528 KB | Output isn't correct |
5 | Incorrect | 2 ms | 584 KB | Output isn't correct |
6 | Incorrect | 2 ms | 584 KB | Output isn't correct |
7 | Incorrect | 2 ms | 584 KB | Output isn't correct |
8 | Incorrect | 2 ms | 584 KB | Output isn't correct |
9 | Incorrect | 2 ms | 584 KB | Output isn't correct |
10 | Incorrect | 2 ms | 584 KB | Output isn't correct |