Submission #98974

#TimeUsernameProblemLanguageResultExecution timeMemory
98974OrtTetris (COCI17_tetris)C++11
80 / 80
2 ms384 KiB
#include<iostream> using namespace std; int f0,f1,f2,f3,f4,n,m; char mat[12][12]; int main() { cin.sync_with_stdio(0); cin.tie(0); cin.exceptions(cin.failbit); cin >> n >> m; for(int i=0;i<n;i++) for(int j=0;j<m;j++) cin >> mat[i][j]; for(int i=0;i<n;i++) for(int j=0;j<m;j++) { if(mat[i][j]=='.') continue; if(i+1<n && j+1<m && mat[i][j]==mat[i+1][j] && mat[i][j]==mat[i][j+1] && mat[i][j]==mat[i+1][j+1]) f0++; if(j+3<m && mat[i][j]==mat[i][j+1] && mat[i][j]==mat[i][j+2] && mat[i][j]==mat[i][j+3]) f1++; if(i+3<n && mat[i][j]==mat[i+1][j] && mat[i][j]==mat[i+2][j] && mat[i][j]==mat[i+3][j]) f1++; if(i+1<n && j+1<m && j-1>=0 && mat[i][j]==mat[i][j+1] && mat[i][j]==mat[i+1][j] && mat[i][j]==mat[i+1][j-1]) f2++; if(i+2<n && j+1<m && mat[i][j]==mat[i+1][j] && mat[i][j]==mat[i+1][j+1] && mat[i][j]==mat[i+2][j+1]) f2++; if(i+1<n && j+2<m && mat[i][j]==mat[i][j+1] && mat[i][j]==mat[i+1][j+1] && mat[i][j]==mat[i+1][j+2]) f3++; if(i+2<n && j-1>=0 && mat[i][j]==mat[i+1][j] && mat[i][j]==mat[i+1][j-1] && mat[i][j]==mat[i+2][j-1]) f3++; if(i+1<n && j+1<m && j-1>=0 && mat[i][j]==mat[i+1][j-1] && mat[i][j]==mat[i+1][j] && mat[i][j]==mat[i+1][j+1]) f4++; if(i+1<n && j+2<m && mat[i][j]==mat[i][j+1] && mat[i][j]==mat[i][j+2] && mat[i][j]==mat[i+1][j+1]) f4++; if(i+2<n && j-1>=0 && mat[i][j]==mat[i+1][j] && mat[i][j]==mat[i+2][j] && mat[i][j]==mat[i+1][j-1]) f4++; if(i+2<n && j+1<m && mat[i][j]==mat[i+1][j] && mat[i][j]==mat[i+2][j] && mat[i][j]==mat[i+1][j+1]) f4++; } cout << f0 << "\n" << f1 << "\n" << f2 << "\n" << f3 << "\n" << f4; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...