Submission #510142

# Submission time Handle Problem Language Result Execution time Memory
510142 2022-01-14T18:09:56 Z khaled_whebe Tetris (COCI17_tetris) C++17
16 / 80
1 ms 320 KB
#include<bits/stdc++.h>
#define endl '\n'
typedef long long ll;
using namespace std;
const int N=555555;
ll n,m,first,sec,thrd,frth,ffth;
char tet[100][100];
bool taken[100][100];
int main()
{
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin>>n>>m;
    for (ll i=0;i<n;i++)
    {
        for (ll j=0;j<m;j++)
            cin>>tet[i][j];
    }
    for (ll i=0;i<n;i++)
    {
        for (ll j=0;j<n;j++)
        {
            if (tet[i][j]>=97&&tet[i][j+1]==tet[i][j]&&tet[i][j]==tet[i][j+2]&&tet[i][j]==tet[i][j+3]&&taken[i][j]==0&&taken[i][j+1]==0&&taken[i][j+2]==0&&taken[i][j+3]==0)
            {
                sec++;
                taken[i][j]=1;
                taken[i][j+1]=1;
                taken[i][j+2]=1;
                taken[i][j+3]=1;
            }
            else if (tet[i][j]>=97&&tet[i][j]==tet[i+1][j+1]&&tet[i][j]==tet[i+1][j]&&tet[i][j]==tet[i][j+1]&&taken[i][j]==0&&taken[i+1][j+1]==0&&taken[i+1][j]==0&&taken[i][j+1]==0)
            {
                first++;
                taken[i][j]=1;
                taken[i+1][j+1]=1;
                taken[i+1][j]=1;
                taken[i][j+1]=1;
            }
            else if (tet[i][j]>=97&&tet[i][j]==tet[i][j+1]&&tet[i][j]==tet[i-1][j+1]&&tet[i-1][j+2]==tet[i][j]&&taken[i][j]==0&&taken[i][j+1]==0&&taken[i-1][j+1]==0&&taken[i-1][j+2]==0)
            {
                thrd++;
                taken[i][j]=1;
                taken[i][j+1]=1;
                taken[i-1][j+1]=1;
                taken[i-1][j+2]=1;

            }
            else if (tet[i][j]>=97&&tet[i][j]==tet[i][j+1]&&tet[i][j]==tet[i+1][j+1]&&tet[i][j]==tet[i+1][j+2]&&taken[i][j]==0&&taken[i][j+1]==0&&taken[i+1][j+1]==0&&taken[i+1][j+2]==0)
            {
                frth++;
                taken[i][j]=1;
                taken[i][j+1]=1;
                taken[i+1][j+1]=1;
                taken[i+1][j+2]=1;
            }
            else if (tet[i][j]>=97&&tet[i][j]==tet[i+1][j]&&tet[i][j]==tet[i+1][j+1]&&tet[i][j]==tet[i+1][j-1]&&taken[i][j]==0&&taken[i+1][j]==0&&taken[i+1][j+1]==0&&taken[i+1][j-1]==0)
            {
                ffth++;
                taken[i][j]=1;
                taken[i+1][j]=1;
                taken[i+1][j+1]=1;
                taken[i+1][j-1]=1;
            }
            else if (tet[i][j]>=97&&tet[i][j]==tet[i][j+1]&&tet[i][j]==tet[i][j+2]&&tet[i][j]==tet[i+1][j+1]&&taken[i][j]==0&&taken[i][j+1]==0&&taken[i][j+2]==0&&taken[i+1][j+1]==0)
            {
                ffth++;
                taken[i][j]=1;
                taken[i][j+1]=1;
                taken[i][j+2]=1;
                taken[i+1][j+1]=1;

            }
        }
    }
    for (ll i=0;i<m;i++)
    {
        for (ll j=0;j<n;j++)
        {
            if (tet[i][j]>=97&&tet[i][j+1]==tet[i][j]&&tet[i][j]==tet[i][j+2]&&tet[i][j]==tet[i][j+3]&&taken[i][j]==0&&taken[i][j+1]==0&&taken[i][j+2]==0&&taken[i][j+3]==0)
            {
                sec++;
                taken[i][j]=1;
                taken[i][j+1]=1;
                taken[i][j+2]=1;
                taken[i][j+3]=1;
            }
            else if (tet[i][j]>=97&&tet[i][j]==tet[i+1][j+1]&&tet[i][j]==tet[i+1][j]&&tet[i][j]==tet[i][j+1]&&taken[i][j]==0&&taken[i+1][j+1]==0&&taken[i+1][j]==0&&taken[i][j+1]==0)
            {
                first++;
                taken[i][j]=1;
                taken[i+1][j+1]=1;
                taken[i+1][j]=1;
                taken[i][j+1]=1;
            }
            else if (tet[i][j]>=97&&tet[i][j]==tet[i][j+1]&&tet[i][j]==tet[i-1][j+1]&&tet[i-1][j+2]==tet[i][j]&&taken[i][j]==0&&taken[i][j+1]==0&&taken[i-1][j+1]==0&&taken[i-1][j+2]==0)
            {
                thrd++;
                taken[i][j]=1;
                taken[i][j+1]=1;
                taken[i-1][j+1]=1;
                taken[i-1][j+2]=1;

            }
            else if (tet[i][j]>=97&&tet[i][j]==tet[i][j+1]&&tet[i][j]==tet[i+1][j+1]&&tet[i][j]==tet[i+1][j+2]&&taken[i][j]==0&&taken[i][j+1]==0&&taken[i+1][j+1]==0&&taken[i+1][j+2]==0)
            {
                frth++;
                taken[i][j]=1;
                taken[i][j+1]=1;
                taken[i+1][j+1]=1;
                taken[i+1][j+2]=1;
            }
            else if (tet[i][j]>=97&&tet[i][j]==tet[i+1][j]&&tet[i][j]==tet[i+1][j+1]&&tet[i][j]==tet[i+1][j-1]&&taken[i][j]==0&&taken[i+1][j]==0&&taken[i+1][j+1]==0&&taken[i+1][j-1]==0)
            {
                ffth++;
                taken[i][j]=1;
                taken[i+1][j]=1;
                taken[i+1][j+1]=1;
                taken[i+1][j-1]=1;
            }
            else if (tet[i][j]>=97&&tet[i][j]==tet[i][j+1]&&tet[i][j]==tet[i][j+2]&&tet[i][j]==tet[i+1][j+1]&&taken[i][j]==0&&taken[i][j+1]==0&&taken[i][j+2]==0&&taken[i+1][j+1]==0)
            {
                ffth++;
                taken[i][j]=1;
                taken[i][j+1]=1;
                taken[i][j+2]=1;
                taken[i+1][j+1]=1;

            }
        }
    }
    cout<<first<<endl<<sec<<endl<<thrd<<endl<<frth<<endl<<ffth<<endl;

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 312 KB Output is correct
2 Correct 1 ms 312 KB Output is correct
3 Incorrect 0 ms 320 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 Incorrect 1 ms 204 KB Output isn't correct
8 Incorrect 0 ms 204 KB Output isn't correct
9 Incorrect 0 ms 204 KB Output isn't correct
10 Incorrect 0 ms 204 KB Output isn't correct