# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1111334 |
2024-11-12T06:09:05 Z |
vjudge1 |
Tetris (COCI17_tetris) |
C++17 |
|
1 ms |
504 KB |
#include <bits/stdc++.h>
using namespace std;
const int N = 505;
int n, m;
char a[N][N];
int b[5];
int main() {
cin >> n >> m;
for (int i = 0; i < n; ++i) {
cin >> a[i];
}
for (int i = 0; i < n; ++i) {
for (int j = 0; j < m; ++j) {
if (a[i][j] == '.') {
continue;
}
if (i+1 < n && j+1 < m &&
a[i+1][j] == a[i][j] &&
a[i][j+1] == a[i][j] &&
a[i+1][j+1] == a[i][j]) {
++b[0];
}
if (j+3 < m &&
a[i][j+1] == a[i][j] &&
a[i][j+2] == a[i][j] &&
a[i][j+3] == a[i][j]) {
++b[1];
}
if (i+3 < n &&
a[i+1][j] == a[i][j] &&
a[i+2][j] == a[i][j] &&
a[i+3][j] == a[i][j]) {
++b[1];
}
if (i+1 < n && j > 0 && j+1 < m &&
a[i+1][j-1] == a[i][j] &&
a[i+1][j] == a[i][j] &&
a[i][j+1] == a[i][j]) {
++b[2];
}
if (i+2 < n && j+1 < m &&
a[i+1][j] == a[i][j] &&
a[i+1][j+1] == a[i][j] &&
a[i+2][j+1] == a[i][j]) {
++b[2];
}
if (i+1 < n && j+2 < m &&
a[i][j+1] == a[i][j] &&
a[i+1][j+1] == a[i][j] &&
a[i+1][j+2] == a[i][j]) {
++b[3];
}
if (i+2 < n && j > 0 &&
a[i+1][j-1] == a[i][j] &&
a[i+1][j] == a[i][j] &&
a[i+2][j-1] == a[i][j]) {
++b[3];
}
if (i+2 < n && j+1 < m &&
a[i+1][j] == a[i][j] &&
a[i+1][j+1] == a[i][j] &&
a[i+2][j] == a[i][j]) {
++b[4];
}
if (i+1 < n && j > 0 && j+1 < m &&
a[i+1][j-1] == a[i][j] &&
a[i+1][j] == a[i][j] &&
a[i+1][j+1] == a[i][j]) {
++b[4];
}
if (i+2 < n && j > 0 &&
a[i+1][j-1] == a[i][j] &&
a[i+1][j] == a[i][j] &&
a[i+2][j] == a[i][j]) {
++b[4];
}
if (i+1 < n && j+2 < m &&
a[i][j+1] == a[i][j] &&
a[i][j+2] == a[i][j] &&
a[i+1][j+1] == a[i][j]) {
++b[4];
}
}
}
for (int i = 0; i < 5; ++i) {
cout << b[i] << endl;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
1 ms |
336 KB |
Output is correct |
8 |
Correct |
1 ms |
336 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
1 ms |
504 KB |
Output is correct |