Submission #141665

#TimeUsernameProblemLanguageResultExecution timeMemory
141665DiviaTetris (COCI17_tetris)C++14
80 / 80
2 ms376 KiB
#include <iostream>
using namespace std;
struct config{
    int n,m,a[4][4];
};
struct piesa{
    int rot;
    config fig[4];
};
piesa 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 n,m,i,j,r,sol[5],l,c,t,ok;
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++)
        for(r=0;r<f[t].rot;r++){
            l=f[t].fig[r].n;
            c=f[t].fig[r].m;
            for(int icolt=0;icolt+l-1<n;icolt++)
                for(int jcolt=0;jcolt+c-1<m;jcolt++)
                    for(char litera='a';litera<='z';litera++){
                        for(ok=1,i=0;i<l;i++)
                            for(j=0;j<c;j++){
                                if(f[t].fig[r].a[i][j]==1 && a[i+icolt][j+jcolt]!=litera)ok=0;
                                if(f[t].fig[r].a[i][j]==0 && a[i+icolt][j+jcolt]==litera)ok=0;
                            }
                        sol[t]+=ok;
            }}
    for(i=0;i<5;i++)
        cout<<sol[i]<<"\n";
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...