Submission #510287

#TimeUsernameProblemLanguageResultExecution timeMemory
510287salamhassanTetris (COCI17_tetris)C++14
64 / 80
1 ms296 KiB
#include <bits/stdc++.h> using namespace std; char a[12][12]; int ans[6],n,m; int main() { cin>>n>>m; for (int i=0; i<n; i++) { for (int j=0; j<m; j++) { cin>>a[i][j]; } } for (int i=0; i<n; i++) { for (int j=0; j<m; j++) { if (a[i][j]!='.') { if (j+3<=m) { if (a[i][j+1]==a[i][j] && a[i][j+2]==a[i][j] && a[i][j+3]==a[i][j]) { ans[2]++; } } if (i+3<=n) { if (a[i+1][j]==a[i][j] && a[i+2][j]==a[i][j] && a[i+3][j]==a[i][j]) { ans[2]++; } } if (a[i][j+1]==a[i][j] && a[i+1][j]==a[i][j] && a[i+1][j+1]==a[i][j]) { ans[1]++; } if (a[i][j+1]==a[i][j] && a[i+1][j]==a[i][j] && a[i+1][j-1]==a[i][j]) ans[3]++; if (a[i+1][j]==a[i][j] && a[i+1][j+1]==a[i][j] && a[i+2][j+1]==a[i][j]) ans[3]++; if (a[i][j+1]==a[i][j] && a[i+1][j+1]==a[i][j] && a[i+1][j+2]==a[i][j]) ans[4]++; if (a[i+1][j]==a[i][j] && a[i+1][j-1]==a[i][j] && a[i+2][j-1]==a[i][j]) ans[4]++; if (a[i][j+1]==a[i][j] && a[i][j+2]==a[i][j] && a[i-1][j+1]==a[i][j]) ans[5]++; if (a[i+1][j]==a[i][j] && a[i+2][j]==a[i][j] && a[i+1][j+1]==a[i][j]) ans[5]++; if (a[i-1][j+1]==a[i][j] && a[i+1][j+1]==a[i][j] && a[i+2][j+1]==a[i][j]) ans[5]++; if (a[i+1][j-1]==a[i][j] && a[i+1][j]==a[i][j] && a[i+1][j+1]==a[i][j]) ans[5]++; } } } for (int i=1; i<=5; i++) cout<<ans[i]<<endl; return 0; }

Compilation message (stderr)

tetris.cpp: In function 'int main()':
tetris.cpp:62:1: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   62 | for (int i=1; i<=5; i++)
      | ^~~
tetris.cpp:64:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   64 |     return 0;
      |     ^~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...