# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
472795 | Mr_OK_Man | Tetris (COCI17_tetris) | C++17 | 1 ms | 204 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;
int main()
{
//F1 1 .. F2 2..F3 2..F4 2..F5 4
long long n,m,f1=0,f2=0,f3=0,f4=0,f5=0;
cin>>n>>m;
char a[30][30]={};
for(int i=1;i<=n;i++)
{
for(int j=1;j<=m;j++)
{
cin>>a[i][j];
}
}
for(int i=1;i<=n;i++)
{
for(int j=1;j<=m;j++)
{
if(a[i][j]!='.')
{ //F1
if(a[i][j]==a[i+1][j+1]&&a[i][j]==a[i][j+1]&&a[i][j]==a[i+1][j])
{
f1++;
}
//F2
if(a[i][j]==a[i][j+1]&&a[i][j]==a[i][j+2]&&a[i][j]==a[i][j+3])
{
f2++;
}
if(a[i][j]==a[i+1][j]&&a[i][j]==a[i+2][j]&&a[i][j]==a[i+3][j])
{
f2++;
}
//F3
if(a[i][j]==a[i][j+1]&&a[i][j]==a[i-1][j+1]&&a[i][j]==a[i-1][j+2])
{
f3++;
}
else if(a[i][j]==a[i+1][j]&&a[i][j]==a[i+1][j+1]&&a[i][j]==a[i+2][j+1])
{
f3++;
}
//F4
if(a[i][j]==a[i][j+1]&&a[i][j]==a[i+1][j+1]&&a[i][j]==a[i+1][j+2])
{
f4++;
}
else if(a[i][j]==a[i+1][j]&&a[i][j]==a[i+1][j-1]&&a[i][j]==a[i+2][j-1])
{
f4++;
}
//F5
if(a[i][j]==a[i][j+1]&&a[i][j]==a[i-1][j+1]&&a[i][j]==a[i][j+2])
{
f5++;
}
if(a[i][j]==a[i][j+1]&&a[i][j]==a[i-1][j+1]&&a[i][j]==a[i+1][j+1])
{
f5++;
}
//F5
if(a[i][j]==a[i][j+1]&&a[i][j]==a[i+1][j+1]&&a[i][j]==a[i][j+2])
{
f5++;
}
if(a[i][j]==a[i][j+1]&&a[i][j]==a[i-1][j]&&a[i][j]==a[i+1][j])
{
f5++;
}
}
}
}
cout<<f1<<endl<<f2<<endl<<f3<<endl<<f4<<endl<<f5<<endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |