Submission #141679

# Submission time Handle Problem Language Result Execution time Memory
141679 2019-08-08T20:42:33 Z Mihnea Tetris (COCI17_tetris) C++14
80 / 80
2 ms 376 KB
#include<iostream>
using namespace std;
int n,m;
int s[5];
char a[10][10];

struct str1{
    int n;
    int m;
    int a[4][4];
};

struct str2{
    int numar;
    str1 fig[4];
};

str2 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 main(){
    cin>>n>>m;
    for(int i=0;i<n;i++)
        for(int j=0;j<m;j++)
            cin>>a[i][j];

    for(int t=0;t<5;t++) {
        ///verificam de cate ori apare figura f[t]
        ///f[t].numar = cate rotatii diferite
        for (int r=0;r<f[t].numar;r++) {
            int lin=f[t].fig[r].n;
            int col=f[t].fig[r].m;
            for(int I=0;I+lin-1<n;I++)
                for(int J=0;J+col-1<m;J++) {
                    for(int lit='a';lit<='z';lit++) {
                        int ok=1;
                        for(int i=0;i<lin;i++)
                            for(int j=0;j<col;j++){
                                if(f[t].fig[r].a[i][j]==1 && a[I+i][J+j]!=lit){
                                    ok=0;
                                }
                                if(f[t].fig[r].a[i][j]==0 && a[I+i][J+j]==lit){
                                    ok=0;
                                }
                            }
                        s[t]+=ok;
                    }
                }
        }
    }

    for(int i=0;i<5;i++)
        cout<<s[i]<<"\n";
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 348 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 256 KB Output is correct