# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
469964 | rainboy | Tetris (COCI17_tetris) | C11 | 1 ms | 272 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>
#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)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |