# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
237056 | MrRobot_28 | Tetris (COCI17_tetris) | C++17 | 5 ms | 384 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;
signed main() {
int n, m;
cin >> n >> m;
vector <vector <char> > A(n, vector <char> (m));
for(int i = 0; i < n; i++)
{
for(int j = 0; j < m; j++)
{
cin >> A[i][j];
}
}
vector <int> ans(5);
for(int i = 0; i < n; i++)
{
for(int j = 0; j < m; j++)
{
if(A[i][j] == '.')
{
continue;
}
if(i > 0 && j > 0 && A[i][j] == A[i - 1][j] && A[i - 1][j] == A[i][j - 1] && A[i - 1][j - 1] == A[i][j])
{
ans[0]++;
}
if(i > 2 && A[i - 3][j] == A[i][j] && A[i - 2][j] == A[i][j] && A[i - 1][j] == A[i][j])
{
ans[1]++;
}
if(j > 2 && A[i][j - 3] == A[i][j] && A[i][j - 2] == A[i][j] && A[i][j - 1] == A[i][j])
{
ans[1]++;
}
if(i > 1 && j > 0 && A[i - 1][j] == A[i][j] && A[i - 1][j - 1] == A[i][j] && A[i - 2][j - 1] == A[i][j])
{
ans[2]++;
}
if(i < n - 1 && j > 1 && A[i][j - 1] == A[i][j] && A[i + 1][j - 1] == A[i][j] && A[i + 1][j - 2] == A[i][j])
{
ans[2]++;
}
if(i > 0 && j > 1 && A[i][j - 1] == A[i][j] && A[i - 1][j - 1] == A[i][j] && A[i - 1][j - 2] == A[i][j])
{
ans[3]++;
}
if(i > 1 && j < m - 1 && A[i - 1][j] == A[i][j] && A[i -1 ][j + 1] == A[i][j] && A[i - 2][j + 1] == A[i][j])
{
ans[3]++;
}
if(i > 0 && j > 0 && i < n - 1 && A[i - 1][j] == A[i][j] && A[i + 1][j] == A[i][j] && A[i][j - 1] == A[i][j])
{
ans[4]++;
}
if(i > 0 && j > 0 && j < m - 1 && A[i - 1][j] == A[i][j] && A[i][j - 1] == A[i][j] && A[i][j + 1] == A[i][j])
{
ans[4]++;
}
if(i < n - 1 && j > 0 && j < m - 1 && A[i][j] == A[i + 1][j] && A[i][j - 1] == A[i][j] && A[i][j + 1] == A[i][j])
{
ans[4]++;
}
if(i > 0 && i < n - 1 && j < m - 1 && A[i][j] == A[i - 1][j] && A[i][j] == A[i][j + 1] && A[i][j] == A[i + 1][j])
{
ans[4]++;
}
}
}
for(int i = 0; i < 5; i++)
{
cout << ans[i] << "\n";
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |