답안 #510273

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
510273 2022-01-14T21:45:20 Z Toqa44 Tetris (COCI17_tetris) C++17
32 / 80
1 ms 316 KB
#include <bits/stdc++.h>
#define  endl "\n"
using namespace std ;
typedef long long ll;
typedef long double ld ;
int n,m,z,c,t,k,l;
char a[13][15];
map<ll,ll>mp;
vector<ll>v;
set<ll>ss;
int main(){
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin>>n>>m;
    for(int g=0;g<n;g++)
    {
        for(int r=0;r<m;r++)
            cin>>a[g][r];
    }
   for(int i=0;i<n;i++)
   {
       for(int j=0;j<m;j++)
       {
           if(a[i][j]=='.')
            continue;
           else
           {
               if(a[i][j]==a[i][j+1]&&a[i][j]==a[i+1][j]&&a[i][j]==a[i+1][j+1])
               {
                     z++;
                     a[i][j]='.';
                     a[i][j+1]='.';
                     a[i+1][j]='.';
                     a[i+1][j+1]='.';
               }
               else if(a[i][j]==a[i][j+1]==a[i][j+2]==a[i][j+3])
               {
                   c++;
                   a[i][j]='.';
                   a[i][j+1]='.';
                   a[i][j+2]='.';
                   a[i][j+3]='.';
               }
               else if(a[i][j]==a[i+1][j]==a[i+2][j]==a[i+3][j])
               {
                   c++;
                   a[i][j]='.';
                   a[i+1][j]='.';
                   a[i+2][j]='.';
                   a[i+3][j]='.';
               }

           }
       }
   }
   cout<<z<<endl<<c<<endl<<t<<endl<<k<<endl<<l<<endl;






    return 0 ;
}

Compilation message

tetris.cpp: In function 'int main()':
tetris.cpp:35:31: warning: suggest parentheses around comparison in operand of '==' [-Wparentheses]
   35 |                else if(a[i][j]==a[i][j+1]==a[i][j+2]==a[i][j+3])
      |                        ~~~~~~~^~~~~~~~~~~
tetris.cpp:35:42: warning: suggest parentheses around comparison in operand of '==' [-Wparentheses]
   35 |                else if(a[i][j]==a[i][j+1]==a[i][j+2]==a[i][j+3])
      |                        ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
tetris.cpp:43:31: warning: suggest parentheses around comparison in operand of '==' [-Wparentheses]
   43 |                else if(a[i][j]==a[i+1][j]==a[i+2][j]==a[i+3][j])
      |                        ~~~~~~~^~~~~~~~~~~
tetris.cpp:43:42: warning: suggest parentheses around comparison in operand of '==' [-Wparentheses]
   43 |                else if(a[i][j]==a[i+1][j]==a[i+2][j]==a[i+3][j])
      |                        ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 304 KB Output is correct
2 Correct 0 ms 316 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Incorrect 0 ms 204 KB Output isn't correct
6 Incorrect 0 ms 204 KB Output isn't correct
7 Incorrect 0 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