#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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
460 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
332 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
332 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
460 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
460 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |