# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
136413 | mariusnicoli | Tetris (COCI17_tetris) | C++14 | 2 ms | 384 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 tip {
int numar;
figura fig[4];
};
tip 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}}}
}
}
};
/**
figura a[1] = { {2,2, { {1,1,0,0},{1,1,0,0},{0,0,0,0},{0,0,0,0}}}
};
figura b[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}}}
};
figura c[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}}}
};
figura d[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}}}
};
figura e[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, i, j, t, r, lin, col, ic, jc, litera;
int sol[5];
char a[10][10];
int main () {
cin>>n>>m;
for (i=0;i<n;i++)
for (j=0;j<m;j++)
cin>>a[i][j];
for (t = 0; t<5; t++) {
/// verificam de cate ori apare figura f[t]
/// aceasta are f[t].numar rotatii diferite
for (r=0;r<f[t].numar;r++) {
/// rotatia r se gaseste in matricea f[t].fig[r] care are
/// f[t].fig[r].n linii f[t].fig[r].m coloane
/// si elementele de forma f[t].fig[r].a[i][j]
lin = f[t].fig[r].n;
col = f[t].fig[r].m;
for (ic=0;ic+lin-1<n;ic++)
for (jc=0;jc+col-1<m;jc++) {
for (litera='a';litera<='z';litera++) {
int ok = 1;
for (i=0;i<lin;i++)
for (j=0;j<col;j++){
if (f[t].fig[r].a[i][j] == 1 && a[ic+i][jc+j] != litera)
ok = 0;
if (f[t].fig[r].a[i][j] == 0 && a[ic+i][jc+j] == litera)
ok = 0;
}
sol[t] += ok;
}
}
}
}
for(i=0;i<5;i++)
cout<<sol[i]<<"\n";
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |