Submission #245188

# Submission time Handle Problem Language Result Execution time Memory
245188 2020-07-05T16:41:09 Z urd05 여왕벌 (KOI15_queen) C++14
10 / 100
5000 ms 92536 KB
#include <bits/stdc++.h>
using namespace std;

int arr[700][700][3][3][3]; //i,j,l,lu,u
int zero[1000000];
int one[1000000];
int two[1000000];
int grow[700][700];
int val[700][700];

typedef pair<int,int> P;

P next(P pt) {
    if (pt.first==0) {
        return P(pt.first,pt.second+1);
    }
    return P(pt.first-1,pt.second);
}

int main(void) {
    int m,n;
    scanf("%d %d\n",&m,&n);
    for(int i=0;i<m;i++) {
        for(int j=0;j<m;j++) {
            val[i][j]=1;
        }
    }
    for(int i=1;i<m;i++) {
        for(int j=1;j<m;j++) {
            for(int l=0;l<3;l++) {
                for(int lu=0;lu<3;lu++) {
                    for(int u=0;u<3;u++) {
                        char x;
                        scanf("%c",&x);
                        if (x=='L') {
                            arr[i][j][l][lu][u]=l;
                        }
                        if (x=='D') {
                            arr[i][j][l][lu][u]=lu;
                        }
                        if (x=='U') {
                            arr[i][j][l][lu][u]=u;
                        }
                    }
                }
            }
            scanf("\n");
        }
    }
    for(int i=0;i<n;i++) {
        scanf("%d %d %d",&zero[i],&one[i],&two[i]);
    }
    for(int ind=0;ind<n;ind++) {
        P pos=P(m-1,0);
        for(int j=0;j<zero[ind];j++) {
            grow[pos.first][pos.second]=0;
            pos=next(pos);
        }
        for(int j=0;j<one[ind];j++) {
            grow[pos.first][pos.second]=1;
            pos=next(pos);
        }
        for(int j=0;j<two[ind];j++) {
            grow[pos.first][pos.second]=2;
            pos=next(pos);
        }
        for(int i=1;i<m;i++) {
            grow[i][i]=arr[i][i][grow[i][i-1]][grow[i-1][i-1]][grow[i-1][i]];
            for(int j=i+1;j<m;j++) {
                grow[i][j]=arr[i][j][grow[i][j-1]][grow[i-1][j-1]][grow[i-1][j]];
            }
            for(int j=i+1;j<m;j++) {
                grow[j][i]=arr[j][i][grow[j][i-1]][grow[j-1][i-1]][grow[j-1][i]];
            }
        }
        for(int i=0;i<m;i++) {
            for(int j=0;j<m;j++) {
                val[i][j]+=grow[i][j];
            }
        }
    }
    for(int i=0;i<m;i++) {
        for(int j=0;j<m;j++) {
            printf("%d ",val[i][j]);
        }
        printf("\n");
    }
}

Compilation message

queen.cpp: In function 'int main()':
queen.cpp:22:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d\n",&m,&n);
     ~~~~~^~~~~~~~~~~~~~~~~
queen.cpp:34:30: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
                         scanf("%c",&x);
                         ~~~~~^~~~~~~~~
queen.cpp:47:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("\n");
             ~~~~~^~~~~~
queen.cpp:51:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d %d",&zero[i],&one[i],&two[i]);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 23 ms 2680 KB Output is correct
4 Correct 23 ms 2680 KB Output is correct
5 Correct 161 ms 15352 KB Output is correct
6 Correct 163 ms 15352 KB Output is correct
7 Correct 166 ms 15352 KB Output is correct
8 Correct 445 ms 38776 KB Output is correct
9 Correct 442 ms 38904 KB Output is correct
10 Correct 846 ms 70544 KB Output is correct
11 Correct 890 ms 70392 KB Output is correct
12 Correct 872 ms 70264 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 640 KB Output is correct
2 Execution timed out 5054 ms 15352 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 12 ms 640 KB Output is correct
2 Correct 1152 ms 2912 KB Output is correct
3 Execution timed out 5071 ms 38648 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 5062 ms 61048 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 280 ms 18112 KB Output is correct
6 Correct 288 ms 17912 KB Output is correct
7 Correct 301 ms 18168 KB Output is correct
8 Correct 303 ms 18040 KB Output is correct
9 Execution timed out 5062 ms 92536 KB Time limit exceeded
10 Halted 0 ms 0 KB -