Submission #403365

#TimeUsernameProblemLanguageResultExecution timeMemory
403365Haruto810198Land of the Rainbow Gold (APIO17_rainbow)C++17
0 / 100
2 ms460 KiB
#include <iostream> #include "rainbow.h" #define FOR(i,l,r,d) for(int i=(l); i<=(r); i+=(d)) int grid[4][200001]; int idx[4][200001]; void init(int R, int C, int sr, int sc, int M, char *S) { /// 0=land 1=river FOR(i,1,R,1){ FOR(j,1,C,1){ grid[i][j] = 0; } } grid[sr][sc] = 1; int rptr=sr, cptr=sc; FOR(i,0,M-1,1){ if(S[i]=='E') cptr++; if(S[i]=='W') cptr--; if(S[i]=='N') rptr--; if(S[i]=='S') rptr++; grid[rptr][cptr] = 1; } FOR(i,1,C,1){ if(grid[1][i]==1 and grid[2][i]==1){ grid[3][i] = 1; } else{ grid[3][i] = 0; } } FOR(j,1,3,1){ if(grid[j][1]==1){ idx[j][1] = 0; } else{ idx[j][1] = 1; } FOR(i,1,C,1){ if(idx[j][i]==0 and idx[j][i-1]==1){ idx[j][i] = idx[j][i-1] + 1; } else{ idx[j][i] = idx[j][i-1]; } } } } int colour(int ar, int ac, int br, int bc) { int R; if(ar==1 and br==2){ R=3; } else{ R=ar; } int ret = idx[bc] - idx[ac]; if(grid[R][ac]==1) ret++; return ret; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...