# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
44581 | heon | Tetris (COCI17_tetris) | C++11 | 2 ms | 584 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |