# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
141679 | Mihnea | 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;
int s[5];
char a[10][10];
struct str1{
int n;
int m;
int a[4][4];
};
struct str2{
int numar;
str1 fig[4];
};
str2 f[5]={
{
1,
{ {2,2,
{
{1,1,0,0},
{1,1,0,0},
{0,0,0,0},
{0,0,0,0}
}
}
}
},
{
2,
{ {1,4,{
{1,1,1,1},
{0,0,0,0},
{0,0,0,0},
{0,0,0,0}
}
},
{4,1,{
{1,0,0,0},
{1,0,0,0},
{1,0,0,0},
{1,0,0,0}
}
}
}
},
{
2,
{ {2,3,{
{0,1,1,0},
{1,1,0,0},
{0,0,0,0},
{0,0,0,0}
}
},
{3,2,{
{1,0,0,0},
{1,1,0,0},
{0,1,0,0},
{0,0,0,0}
}
}
}
},
{
2,
{ {2,3,{
{1,1,0,0},
{0,1,1,0},
{0,0,0,0},
{0,0,0,0}
}
},
{3,2,{
{0,1,0,0},
{1,1,0,0},
{1,0,0,0},
{0,0,0,0}
}
}
}
},
{
4,
{ {2,3,{
{0,1,0,0},
{1,1,1,0},
{0,0,0,0},
{0,0,0,0}
}
},
{2,3,{
{1,1,1,0},
{0,1,0,0},
{0,0,0,0},
{0,0,0,0}
}
},
{3,2,{
{0,1,0,0},
{1,1,0,0},
{0,1,0,0},
{0,0,0,0}
}
},
{3,2,{
{1,0,0,0},
{1,1,0,0},
{1,0,0,0},
{0,0,0,0}
}
}
}
}
};
int main(){
cin>>n>>m;
for(int i=0;i<n;i++)
for(int j=0;j<m;j++)
cin>>a[i][j];
for(int t=0;t<5;t++) {
///verificam de cate ori apare figura f[t]
///f[t].numar = cate rotatii diferite
for (int r=0;r<f[t].numar;r++) {
int lin=f[t].fig[r].n;
int col=f[t].fig[r].m;
for(int I=0;I+lin-1<n;I++)
for(int J=0;J+col-1<m;J++) {
for(int lit='a';lit<='z';lit++) {
int ok=1;
for(int i=0;i<lin;i++)
for(int j=0;j<col;j++){
if(f[t].fig[r].a[i][j]==1 && a[I+i][J+j]!=lit){
ok=0;
}
if(f[t].fig[r].a[i][j]==0 && a[I+i][J+j]==lit){
ok=0;
}
}
s[t]+=ok;
}
}
}
}
for(int i=0;i<5;i++)
cout<<s[i]<<"\n";
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |