#include "rainbow.h"
#include <bits/stdc++.h>
using namespace std;
#define pii pair<int,int>
#define fs first
#define sc second
const int mxn = 2e5+10;
int arr[3][mxn];
int pref[mxn];
int row[2][mxn];
void init(int R, int C, int sr, int sc, int M, char *S) {
memset(arr,0,sizeof(arr));
pii now = pii(sr,sc);
arr[now.fs][now.sc] = -1;
for(int i = 0;i<M;i++){
if(S[i] == 'N')now.fs--;
else if(S[i] == 'S')now.fs++;
else if(S[i] == 'E')now.sc++;
else if(S[i] == 'W')now.sc--;
arr[now.fs][now.sc] = -1;
}
for(int i = 1;i<=C;i++){
pref[i] = pref[i-1];
row[0][i] = row[0][i-1];
row[1][i] = row[1][i-1];
if(arr[0][i] == -1&&arr[0][i-1] != -1)row[0][i]++;
if(arr[1][i] == -1&&arr[1][i-1] != -1)row[1][i]++;
if(arr[0][i] == arr[1][i]&&arr[0][i] == -1&&(arr[0][i-1] != -1||arr[1][i-1] != -1))pref[i]++;
}
return;
}
int colour(int ar, int ac, int br, int bc) {
if(ar == br){
int cnt = row[ar][bc]-row[ar][ac-1];
if(arr[ar][ac] != -1)cnt++;
if(arr[br][bc] != -1)cnt++;
return cnt;
}
else{
int cnt = pref[bc]-pref[ac-1];
if(arr[ar][0] != -1||arr[ar][1] != -1)cnt++;
if(arr[br][0] != -1||arr[br][1] != -1)cnt++;
return cnt;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
3 ms |
5468 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
2908 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
2908 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
3 ms |
5468 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
3 ms |
5468 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |