# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
146306 | Luca_Girbovan | Tetris (COCI17_tetris) | C++11 | 4 ms | 380 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;
struct figura {
int n;
int m;
int a[4][4];
};
struct varf {
int valoare;
figura fig[4];
};
varf form[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 n, m, x, y, litera, ok;
int sol[5];
char a[10][10];
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 pas=0; pas<5; pas++){
for(int rotatia=0; rotatia < form[pas].valoare; rotatia++){
x=form[pas].fig[rotatia].n;
y=form[pas].fig[rotatia].m;
for(int i=0; i+x-1 < n; i++){
for(int j=0; j+y-1 < m; j++){
for(litera='a'; litera <= 'z'; litera++){
ok=1;
for(int ii=0; ii < x; ii++){
for(int jj=0; jj < y; jj++){
if(form[pas].fig[rotatia].a[ii][jj] == 1 && a[i+ii][j+jj] != litera)
ok=0;
if(form[pas].fig[rotatia].a[ii][jj] == 0 && a[i+ii][j+jj] == litera)
ok=0;
}
}
sol[pas]+=ok;
}
}
}
}
}
for(int i=0; i<5; i++)
cout<<sol[i]<<"\n";
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |