Submission #510276

# Submission time Handle Problem Language Result Execution time Memory
510276 2022-01-14T21:52:07 Z khaled_whebe Tetris (COCI17_tetris) C++17
80 / 80
0 ms 204 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 a[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>>a[i][j];
    }
    for (ll i=0;i<n;i++)
    {
        for (ll j=0;j<m;j++)
        {
            if (a[i][j]>=97&&a[i][j]==a[i][j+1]&&a[i][j]==a[i+1][j]&&a[i][j]==a[i+1][j+1])
                first++;
            else if (a[i][j]>=97&&(a[i][j]==a[i][j+1]&&a[i][j]==a[i][j+2]&&a[i][j]==a[i][j+3]))
                sec++;
            else if (a[i][j]>=97&&(a[i][j]==a[i+1][j]&&a[i][j]==a[i+2][j]&&a[i][j]==a[i+3][j]))
                sec++;
            else if (a[i][j]>=97&&((a[i][j]==a[i][j+1]&&a[i][j]==a[i+1][j]&&a[i][j]==a[i+1][j-1])||(a[i][j]==a[i+1][j]&&a[i][j]==a[i+1][j+1]&&a[i][j]==a[i+2][j+1])))
                thrd++;
            else if (a[i][j]>=97&&((a[i][j]==a[i][j+1]&&a[i][j]==a[i+1][j+1]&&a[i][j]==a[i+1][j+2])||(a[i][j]==a[i+1][j]&&a[i][j]==a[i+1][j-1]&&a[i][j]==a[i+2][j-1])))
                frth++;
            else if (a[i][j]>=97&&((a[i][j]==a[i+1][j]&&a[i][j]==a[i+1][j+1]&&a[i][j]==a[i+1][j-1])||(a[i][j]==a[i][j+1]&&a[i][j]==a[i][j+2]&&a[i][j]==a[i+1][j+1])||(a[i][j]==a[i+1][j]&&a[i][j]==a[i+2][j]&&a[i][j]==a[i+1][j+1])||(a[i][j]==a[i+1][j]&&a[i][j]==a[i+2][j]&&a[i][j]==a[i+1][j-1])))
                ffth++;
 
        }
    }
    cout<<first<<endl<<sec<<endl<<thrd<<endl<<frth<<endl<<ffth<<endl;
    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 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct