# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
472810 | Ahmed57 | Tetris (COCI17_tetris) | C++14 | 1 ms | 204 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |