# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
200894 | SamAnd | Tetris (COCI17_tetris) | C++17 | 5 ms | 376 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 <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)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |