Submission #472810

#TimeUsernameProblemLanguageResultExecution timeMemory
472810Ahmed57Tetris (COCI17_tetris)C++14
80 / 80
1 ms204 KiB
#include<bits/stdc++.h> using namespace std; int main(){ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); int n,m; cin>>n>>m; char a[n+10][m+10];memset(a,'.',sizeof a); for(int i = 1;i<=n;i++){ for(int j = 1;j<=m;j++){ cin>>a[i][j]; } } map<int,int> mp; for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++) { if(a[i][j]!='.'){ if(a[i][j]==a[i+1][j+1]&&a[i][j]==a[i][j+1]&&a[i][j]==a[i+1][j]){ mp[1]++; } if(a[i][j]==a[i][j+1]&&a[i][j]==a[i][j+2]&&a[i][j]==a[i][j+3]){ mp[2]++; } if(a[i][j]==a[i+1][j]&&a[i][j]==a[i+2][j]&&a[i][j]==a[i+3][j]){ mp[2]++; } if(a[i][j]==a[i][j+1]&&a[i][j]==a[i-1][j+1]&&a[i][j]==a[i-1][j+2]){ mp[3]++; } 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]){ mp[3]++; } if(a[i][j]==a[i][j+1]&&a[i][j]==a[i+1][j+1]&&a[i][j]==a[i+1][j+2]){ mp[4]++; } if(a[i][j]==a[i+1][j]&&a[i][j]==a[i+1][j-1]&&a[i][j]==a[i+2][j-1]){ mp[4]++; } if(a[i][j]==a[i][j+1]&&a[i][j]==a[i-1][j+1]&&a[i][j]==a[i][j+2]){ mp[5]++; } if(a[i][j]==a[i][j+1]&&a[i][j]==a[i-1][j+1]&&a[i][j]==a[i+1][j+1]){ mp[5]++; } if(a[i][j]==a[i][j+1]&&a[i][j]==a[i+1][j+1]&&a[i][j]==a[i][j+2]){ mp[5]++; } if(a[i][j]==a[i][j+1]&&a[i][j]==a[i-1][j]&&a[i][j]==a[i+1][j]){ mp[5]++; } } } } for(int i = 1;i<=5;i++){ cout<<mp[i]<<"\n"; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...