Submission #472795

# Submission time Handle Problem Language Result Execution time Memory
472795 2021-09-14T10:43:34 Z Mr_OK_Man Tetris (COCI17_tetris) C++17
80 / 80
1 ms 204 KB
#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
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct