# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
262478 | 2020-08-13T01:18:04 Z | daniel920712 | Land of the Rainbow Gold (APIO17_rainbow) | C++14 | 91 ms | 7176 KB |
#include "rainbow.h" #include <queue> #include <stdio.h> #include <utility> using namespace std; int all[55][200005]={0}; bool have[55][200005]={0}; int dx[5]={1,0,-1,0}; int dy[5]={0,-1,0,1}; int con1[200005]={0}; int con2[200005]={0}; int con3[200005]={0}; queue < pair < int , int > > BFS; void init(int R, int C, int sr, int sc, int M, char *S) { all[sr][sc]=1; int i,j,now1=0,now2=0,now3=0; for(i=0;i<M;i++) { if(S[i]=='N') sr--; if(S[i]=='S') sr++; if(S[i]=='E') sc++; if(S[i]=='W') sc--; all[sr][sc]=1; } /*for(i=1;i<=R;i++) { for(j=1;j<=C;j++) printf("%d",all[i][j]); printf("\n"); }*/ for(i=1;i<=C;i++) { if((all[2][i]==0||all[1][i]==0)&&(i==1||(all[2][i-1]==1&&all[1][i-1]==1))) con3[i]=++now3; else con3[i]=con3[i-1]; if((all[1][i]==0)&&(i==1||(all[1][i-1]==1))) con1[i]=++now1; else con1[i]=con1[i-1]; if((all[2][i]==0)&&(i==1||(all[2][i-1]==1))) con2[i]=++now2; else con2[i]=con2[i-1]; } } int colour(int ar, int ac, int br, int bc) { int ans=0,x,y,i,j,k; if(ar==1&&br==1) return con1[bc]-con1[ac]+(all[1][ac]==0); if(ar==2&&br==2) return con2[bc]-con2[ac]+(all[2][ac]==0); return con3[bc]-con3[ac]+((all[1][ac]==0||all[2][ac]==0)); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 512 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 384 KB | Output is correct |
2 | Correct | 0 ms | 384 KB | Output is correct |
3 | Correct | 71 ms | 6500 KB | Output is correct |
4 | Correct | 91 ms | 7160 KB | Output is correct |
5 | Correct | 76 ms | 7160 KB | Output is correct |
6 | Correct | 72 ms | 6776 KB | Output is correct |
7 | Correct | 74 ms | 6896 KB | Output is correct |
8 | Correct | 87 ms | 6372 KB | Output is correct |
9 | Correct | 85 ms | 7176 KB | Output is correct |
10 | Correct | 69 ms | 7024 KB | Output is correct |
11 | Correct | 77 ms | 6704 KB | Output is correct |
12 | Correct | 59 ms | 6724 KB | Output is correct |
13 | Correct | 72 ms | 7032 KB | Output is correct |
14 | Correct | 59 ms | 7032 KB | Output is correct |
15 | Correct | 62 ms | 6648 KB | Output is correct |
16 | Correct | 72 ms | 6648 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 384 KB | Output is correct |
2 | Runtime error | 4 ms | 640 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 512 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 512 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |