답안 #153008

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
153008 2019-09-11T10:01:09 Z ionanghelina Tetris (COCI17_tetris) C++14
80 / 80
2 ms 376 KB
#include<bits/stdc++.h>
using namespace std;
const int maxN=20;
int n,m;
char a[maxN][maxN];
struct figura
{
    int n,m;
    int a[5][5];
};

struct tip
{
    int nrrot;
    figura fig[4];
};

tip v[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 sol[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 f=0;f<5;f++) //figura
    {
        for(int k=0;k<v[f].nrrot;k++) //rotatia
        {
            int l,c;
            l=v[f].fig[k].n;
            c=v[f].fig[k].m;
            for(int ic=0;ic+l-1<n;ic++)
                for(int jc=0;jc+c-1<m;jc++)
            {
                for(char ch='a';ch<='z';ch++)
                {
                    bool ok=1;
                    for(int i=0;i<l;i++)
                        for(int j=0;j<c;j++)
                    {
                        if(v[f].fig[k].a[i][j]==1 && a[ic+i][jc+j]!=ch) ok=0;
                        if(v[f].fig[k].a[i][j]==0 && a[ic+i][jc+j]==ch) ok=0;
                    }
                    if(ok) sol[f]++;
                }

            }
        }
    }

    for(int i=0;i<5;i++)
        cout<<sol[i]<<'\n';
    return 0;
}
# 결과 실행 시간 메모리 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 376 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 376 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 256 KB Output is correct