Submission #510273

#TimeUsernameProblemLanguageResultExecution timeMemory
510273Toqa44Tetris (COCI17_tetris)C++17
32 / 80
1 ms316 KiB
#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 (stderr)

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])
      |                        ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...