답안 #145164

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
145164 2019-08-18T23:27:02 Z mihaican Tetris (COCI17_tetris) C++14
80 / 80
2 ms 504 KB
#include <iostream>
using namespace std;
struct fm {
    int n;
    int m;
    int a[5][5];
};

struct piese {
    int numar;
    fm fig[5];
};
piese 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,v[10],y,x;
char a[10][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 piese=0;piese<5;piese++)
        for (int f2=0;f2<f[piese].numar;f2++){
            x=f[piese].fig[f2].n;
            y=f[piese].fig[f2].m;
            for(int i2=0;x+i2<n+1;i2++)
                for(int j2=0;j2+y<m+1;j2++){
                    for(int litera='a';litera<='z';litera++){
                        int ok=1;
                        for(int i=0;i<x;i++)
                            for(int j=0;j<y;j++){
                                if(f[piese].fig[f2].a[i][j]==1&&a[i2+i][j2+j]!=litera)
                                    ok=0;
                                if(f[piese].fig[f2].a[i][j]==0&&a[i2+i][j2+j]==litera)
                                    ok=0;
                            }
                        v[piese]+=ok;
                    }
                }
        }
    for(int i=0;i<5;i++)
        cout<<v[i]<<"\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 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 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 504 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 256 KB Output is correct