답안 #929158

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
929158 2024-02-17T19:17:40 Z Zena_Hossam Tetris (COCI17_tetris) C++14
80 / 80
1 ms 436 KB
#include <bits/stdc++.h>
using namespace std;
#define fi ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
//#define ll double
#define ll long long
#define F first
#define S second
#define sz size()
#define all(s) s.begin(),s.end()
#define all1(s) s.rbegin(),s.rend()
int main()
{
   // freopen("maxcross.in","r",stdin);freopen("maxcross.out","w",stdout);

    ll T=1;
    //cin>>T;ll oo=0;
    while(T--)
    {
        ll n,m;
        cin>>n>>m;
        char a[n][m];
        for(ll i=0;i<n;i++){
            for(ll j=0;j<m;j++){
                cin>>a[i][j];
            }
        }ll arr[5]={};
        for(ll i=0;i<n;i++){
            for(ll j=0;j<m;j++){if(a[i][j]=='.')continue;
                if(i+1!=n&&j+1!=m&&(a[i][j]==a[i+1][j]&&a[i][j]==a[i+1][j+1]&&a[i][j]==a[i][j+1])){
                    arr[0]++;
                }
                else if(j+3<m&&((a[i][j]==a[i][j+1]&&a[i][j]==a[i][j+2]&&a[i][j]==a[i][j+3]))){
                     arr[1]++;
                }
                else if(j+1!=m&&j-1>=0&&i+1!=n&&(a[i][j]==a[i][j+1]&&a[i][j]==a[i+1][j]&&a[i][j]==a[i+1][j-1])){
                    arr[2]++;
                }
                 else if(j+1!=m&&j-1>=0&&i+1!=n&&(a[i][j]==a[i][j-1]&&a[i][j]==a[i+1][j]&&a[i][j]==a[i+1][j+1])){
                    arr[3]++;
                }
                else if(j+1!=m&&j-1>=0&&i+1!=n&&((a[i][j]==a[i+1][j-1]&&a[i][j]==a[i+1][j]&&a[i][j]==a[i+1][j+1]))){
                    arr[4]++;
                }
                if(i+3<n&&((a[i][j]==a[i+1][j]&&a[i][j]==a[i+2][j]&&a[i][j]==a[i+3][j]))){
                     arr[1]++;
                }
                else if(j+1!=m&&i-1>=0&&i+1!=n&&(a[i][j]==a[i][j+1]&&a[i][j]==a[i-1][j]&&a[i][j]==a[i+1][j+1])){
                    arr[2]++;
                }
                 else if(j+1!=m&&i-1>=0&&i+1!=n&&(a[i][j]==a[i+1][j]&&a[i][j]==a[i][j+1]&&a[i][j]==a[i-1][j+1])){
                    arr[3]++;
                }
                else if(i+1!=n&&i-1>=0&&j+1!=m&&((a[i][j]==a[i][j+1]&&a[i][j]==a[i+1][j]&&a[i][j]==a[i-1][j]))){
                    arr[4]++;
                }
                else if(j+1!=m&&j-1>=0&&i+1!=n&&((a[i][j]==a[i+1][j]&&a[i][j]==a[i][j-1]&&a[i][j]==a[i][j+1]))){
                    arr[4]++;
                }
                else if(i-1>=0&&j-1>=0&&i+1!=n&&((a[i][j]==a[i+1][j]&&a[i][j]==a[i-1][j]&&a[i][j]==a[i][j-1]))){
                    arr[4]++;
                }
            }
        }for(ll i=0;i<5;i++)cout<<arr[i]<<"\n";
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 436 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct