#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
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]);
~~~~~^~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Correct |
5 ms |
376 KB |
Output is correct |
4 |
Correct |
5 ms |
256 KB |
Output is correct |
5 |
Correct |
4 ms |
256 KB |
Output is correct |
6 |
Correct |
5 ms |
256 KB |
Output is correct |
7 |
Correct |
5 ms |
256 KB |
Output is correct |
8 |
Correct |
4 ms |
256 KB |
Output is correct |
9 |
Correct |
5 ms |
256 KB |
Output is correct |
10 |
Correct |
5 ms |
256 KB |
Output is correct |