# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
153008 | ionanghelina | 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<bits/stdc++.h>
using namespace std;
const int maxN=20;
int n,m;
char a[maxN][maxN];
struct figura
{
int n,m;
int a[5][5];
};
struct tip
{
int nrrot;
figura fig[4];
};
tip v[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 sol[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 f=0;f<5;f++) //figura
{
for(int k=0;k<v[f].nrrot;k++) //rotatia
{
int l,c;
l=v[f].fig[k].n;
c=v[f].fig[k].m;
for(int ic=0;ic+l-1<n;ic++)
for(int jc=0;jc+c-1<m;jc++)
{
for(char ch='a';ch<='z';ch++)
{
bool ok=1;
for(int i=0;i<l;i++)
for(int j=0;j<c;j++)
{
if(v[f].fig[k].a[i][j]==1 && a[ic+i][jc+j]!=ch) ok=0;
if(v[f].fig[k].a[i][j]==0 && a[ic+i][jc+j]==ch) ok=0;
}
if(ok) sol[f]++;
}
}
}
}
for(int i=0;i<5;i++)
cout<<sol[i]<<'\n';
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |