# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
141651 | RobertDobra | Tetris (COCI17_tetris) | C++14 | 2 ms | 376 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 <iostream>
using namespace std;
int n,m,i,j,ok[12][12],v[7];
char a[12][12];
int di[4]={1,-1,0,0};
int dj[4]={0,0,1,-1};
void fill(int x,int y){
ok[x][y]=1;
for (int t=0;t<4;t++)
if (x+di[t]>0 && x+di[t]<=n && y+dj[t]>0 && y+dj[t]<=m && !ok[x+di[t]][y+dj[t]] && a[x][y]==a[x+di[t]][y+dj[t]])
fill(x+di[t],y+dj[t]);
}
int te(int x,int y){
return a[i][j]==a[i+x][j+y];
}
int main(){
cin>>n>>m;
for (i=1;i<=n;i++)
for (j=1;j<=m;j++)
cin>>a[i][j];
for (i=1;i<=n;i++)
for (j=1;j<=m;j++)
if (a[i][j]!='.' && !ok[i][j]){
fill(i,j);
if (te(0,1) && te(1,0) && te(1,1))
v[1]++;
if ((te(0,1) && te(0,2) && te(0,3)) || (te(1,0) && te(2,0) && te(3,0)))
v[2]++;
if ((te(0,1) && te(1,0) && te(1,-1)) || (te(1,0) && te(1,1) && te(2,1)))
v[3]++;
if ((te(0,1) && te(1,1) && te(1,2)) || (te(1,0) && te(1,-1) && te(2,-1)))
v[4]++;
if ((te(1,-1) && te(1,0) && te(1,1)) || (te(1,-1) && te(1,0) && te(2,0)) ||
(te(0,1) && te(0,2) && te(1,1)) || (te(1,0) && te(1,1) && te(2,0)))
v[5]++;
}
for (i=1;i<6;i++)
cout<<v[i]<<'\n';
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |