Submission #472795

#TimeUsernameProblemLanguageResultExecution timeMemory
472795Mr_OK_ManTetris (COCI17_tetris)C++17
80 / 80
1 ms204 KiB
#include <bits/stdc++.h> using namespace std; int main() { //F1 1 .. F2 2..F3 2..F4 2..F5 4 long long n,m,f1=0,f2=0,f3=0,f4=0,f5=0; cin>>n>>m; char a[30][30]={}; for(int i=1;i<=n;i++) { for(int j=1;j<=m;j++) { cin>>a[i][j]; } } for(int i=1;i<=n;i++) { for(int j=1;j<=m;j++) { if(a[i][j]!='.') { //F1 if(a[i][j]==a[i+1][j+1]&&a[i][j]==a[i][j+1]&&a[i][j]==a[i+1][j]) { f1++; } //F2 if(a[i][j]==a[i][j+1]&&a[i][j]==a[i][j+2]&&a[i][j]==a[i][j+3]) { f2++; } if(a[i][j]==a[i+1][j]&&a[i][j]==a[i+2][j]&&a[i][j]==a[i+3][j]) { f2++; } //F3 if(a[i][j]==a[i][j+1]&&a[i][j]==a[i-1][j+1]&&a[i][j]==a[i-1][j+2]) { f3++; } else if(a[i][j]==a[i+1][j]&&a[i][j]==a[i+1][j+1]&&a[i][j]==a[i+2][j+1]) { f3++; } //F4 if(a[i][j]==a[i][j+1]&&a[i][j]==a[i+1][j+1]&&a[i][j]==a[i+1][j+2]) { f4++; } else if(a[i][j]==a[i+1][j]&&a[i][j]==a[i+1][j-1]&&a[i][j]==a[i+2][j-1]) { f4++; } //F5 if(a[i][j]==a[i][j+1]&&a[i][j]==a[i-1][j+1]&&a[i][j]==a[i][j+2]) { f5++; } if(a[i][j]==a[i][j+1]&&a[i][j]==a[i-1][j+1]&&a[i][j]==a[i+1][j+1]) { f5++; } //F5 if(a[i][j]==a[i][j+1]&&a[i][j]==a[i+1][j+1]&&a[i][j]==a[i][j+2]) { f5++; } if(a[i][j]==a[i][j+1]&&a[i][j]==a[i-1][j]&&a[i][j]==a[i+1][j]) { f5++; } } } } cout<<f1<<endl<<f2<<endl<<f3<<endl<<f4<<endl<<f5<<endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...