Submission #472743

# Submission time Handle Problem Language Result Execution time Memory
472743 2021-09-14T09:13:27 Z SaraMostafa Tetris (COCI17_tetris) C++14
32 / 80
1 ms 204 KB
#include <bits/stdc++.h>
#include<unordered_map>
using namespace std;
#define ll long long
#define endl "\n"
#define Sara ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const long long mod=998244353;
const double PI=acos(-1);
int main()
{
    //freopen("input.in","r",stdin);
    Sara
    int n,m;
    cin>>n>>m;
    int f1=0,f2=0,f3=0,f4=0,f5=0;
    vector<vector<char>>v(30,vector<char>(30));
    for(int i=1; i<=n; i++)
    {
        for(int j=1; j<=m; j++)
        {
            cin>>v[i][j];
        }
    }
    vector<vector<bool>>vs(30,vector<bool>(30));
    for(int i=1; i<=n; i++)
    {
        for(int j=1; j<=m; j++)
        {
            if(v[i][j]!='.' && !vs[i][j])
            {
 /*figure 1*/   if(v[i+1][j]==v[i][j] && v[i][j+1]==v[i][j] && v[i+1][j+1]==v[i][j] && !vs[i+1][j] && !vs[i][j+1] && !vs[i+1][j+1])
                {
                    f1++;
                    vs[i+1][j]=1;
                    vs[i][j+1]=1;
                    vs[i][j]=1;
                    vs[i+1][j+1]=1;
                }

/*figure 2*/   if(v[i][j+1]==v[i][j] && v[i][j+2]==v[i][j] && v[i][j+3]==v[i][j] && !vs[i][j+1] && !vs[i][j+2] && !vs[i][j+3])
                {
                    f2++;
                    vs[i][j+1]=1;
                    vs[i][j+2]=1;
                    vs[i][j]=1;
                    vs[i][j+3]=1;
                }
                 else if(v[i+1][j]==v[i][j] && v[i+2][j]==v[i][j] && v[i+3][j]==v[i][j] && !vs[i+1][j] && !vs[i+2][j] && !vs[i+3][j]){
                    f1++;
                    vs[i+1][j]=1;
                    vs[i+2][j]=1;
                    vs[i+3][j]=1;
                    vs[i][j]=1;
                }
/*figure 3*/   if(v[i+1][j]==v[i][j] && v[i+1][j-1]==v[i][j] && v[i][j+1]==v[i][j] && !vs[i+1][j] && !vs[i+1][j-1] && !vs[i][j+1])
                {
                    f3++;
                    vs[i+1][j]=1;
                    vs[i+1][j-1]=1;
                    vs[i][j]=1;
                    vs[i][j+1]=1;
                }
            else if(v[i+1][j]==v[i][j] && v[i+1][j+1]==v[i][j] && v[i+2][j+1]==v[i][j] && !vs[i+1][j] && !vs[i+1][j+1] && !vs[i+2][j+1])
            {
                f3++;
                vs[i+1][j]=1;
                vs[i+1][j+1]=1;
                vs[i+2][j+1]=1;
                vs[i][j]=1;
            }
/*figure 4*/    if(v[i+1][j+2]==v[i][j] && v[i+1][j+1]==v[i][j] && v[i][j+1]==v[i][j] && !vs[i+1][j+2] && !vs[i+1][j+1] && !vs[i][j+1])
                {
                    f4++;
                    vs[i+1][j+2]=1;
                    vs[i+1][j+1]=1;
                    vs[i][j]=1;
                    vs[i][j+1]=1;
                }
            else if(v[i+1][j]==v[i][j] && v[i+1][j-1]==v[i][j] && v[i+2][j-1]==v[i][j] && !vs[i+1][j] && !vs[i+1][j-1] && !vs[i+2][j-1])
            {
                f4++;
                vs[i+1][j]=1;
                vs[i+1][j-1]=1;
                vs[i+2][j-1]=1;
                vs[i][j]=1;
            }
/*figure 5*/    if(v[i+1][j-1]==v[i][j] && v[i+1][j]==v[i][j] && v[i+1][j+1]==v[i][j] && !vs[i+1][j-1] && !vs[i+1][j] && !vs[i+1][j+1])
                {
                    f5++;
                    vs[i+1][j-1]=1;
                    vs[i+1][j]=1;
                    vs[i][j]=1;
                    vs[i+1][j+1]=1;
                }
                else if(v[i+1][j]==v[i][j] && v[i+2][j]==v[i][j] && v[i+1][j+1]==v[i][j] && !vs[i+1][j] && !vs[i+2][j] && !vs[i+1][j+1] )
                {
                    f5++;
                    vs[i+1][j]=1;
                    vs[i+2][j]=1;
                    vs[i+1][j+1]=1;
                    vs[i][j]=1;
                }
                else if(v[i][j+1]==v[i][j] && v[i][j+2]==v[i][j] && v[i+1][j+1]==v[i][j] && !vs[i][j+1] && !vs[i][j+2] && !vs[i+1][j+1])
                {
                    f5++;
                    vs[i][j+1]=1;
                    vs[i][j+2]=1;
                    vs[i+1][j+1]=1;
                    vs[i][j]=1;
                }
                 else if(v[i+1][j]==v[i][j] && v[i+2][j]==v[i][j] && v[i+1][j-1]==v[i][j] && !vs[i+1][j] && !vs[i+2][j] && !vs[i+1][j-1] )
                {
                    f5++;
                    vs[i+1][j]=1;
                    vs[i+2][j]=1;
                    vs[i+1][j-1]=1;
                    vs[i][j]=1;
                }
            }
        }
    }
    cout<<f1<<endl<<f2<<endl<<f3<<endl<<f4<<endl<<f5;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Incorrect 1 ms 204 KB Output isn't correct
4 Incorrect 0 ms 204 KB Output isn't correct
5 Incorrect 0 ms 204 KB Output isn't correct
6 Incorrect 0 ms 204 KB Output isn't correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Incorrect 1 ms 204 KB Output isn't correct
10 Incorrect 0 ms 204 KB Output isn't correct