# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
139396 | mariadinca | Tetris (COCI17_tetris) | C++14 | 5 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, h, f, w, t, sol[6];
char x[12][12];
struct figura{
int ne;
int me;
int v[4][4];
};
struct tip{
int rotatii;
figura fig[4];
};
tip s[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}}},
{3, 2, {{1, 0, 0, 0}, {1, 1, 0, 0}, {1, 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}}}}
}
};
int main(){
cin>>n>>m;
for(i=1;i<=n;i++)
for(j=1;j<=m;j++)
cin>>x[i][j];
for(i=1;i<=n;i++)
for(j=1;j<=m;j++){
for(t=0;t<5;t++){
for(w=0;w<s[t].rotatii;w++){
int lin = s[t].fig[w].ne;
int col = s[t].fig[w].me;
for(char lit = 'a';lit <= 'z';lit++){
int ok = 1;
for(h=i;h<=i+lin-1;h++)
for(f=j;f<=j+col-1;f++)
if(!((x[h][f] == lit && s[t].fig[w].v[h-i][f-j] == 1) || (x[h][f] != lit && s[t].fig[w].v[h-i][f-j] == 0))){
h = i+lin;
ok = 0;
break;
}
if(ok == 1)
sol[t]++;
}
}
}
}
for(i=0;i<5;i++)
cout<<sol[i]<<endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |