이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "rainbow.h"
using namespace std;
vector<vector<bool>> land;
vector<int> S1, S2, S12;
void init(int R, int C, int sr, int sc, int M, char *S){
  sr--;
  sc--;
  land = vector<vector<bool>>(R, vector<bool>(C, true));
  int x = sr, y = sc;
  land[x][y] = false;
  for (int i = 0; i < M; i++){
    if (S[i] == 'N'){
      x--;
    }
    if (S[i] == 'S'){
      x++;
    }
    if (S[i] == 'E'){
      y++;
    }
    if (S[i] == 'W'){
      y--;
    }
    land[x][y] = false;
  }
  S1 = vector<int>(C);
  S1[0] = 0;
  for (int i = 0; i < C - 1; i++){
    S1[i + 1] = S1[i];
    if (!land[0][i] && land[0][i + 1]){
      S1[i + 1]++;
    }
  }
  S2 = vector<int>(C);
  S2[0] = 0;
  for (int i = 0; i < C - 1; i++){
    S2[i + 1] = S2[i];
    if (!land[1][i] && land[1][i + 1]){
      S2[i + 1]++;
    }
  }
  S12 = vector<int>(C);
  S12[0] = 0;
  for (int i = 0; i < C - 1; i++){
    S12[i + 1] = S12[i];
    if (!land[0][i] && !land[1][i] && (land[0][i + 1] || land[1][i + 1])){
      S12[i + 1]++;
    }
    if (land[0][i] && !land[1][i] && !land[0][i + 1] && land[1][i + 1]){
      S12[i + 1]++;
    }
    if (!land[0][i] && land[1][i] && land[0][i + 1] && !land[1][i + 1]){
      S12[i + 1]++;
    }
  }
}
int colour(int ar, int ac, int br, int bc){
  ar--;
  ac--;
  if (ar == 0 && br == 1){
    int ans = S1[bc - 1] - S1[ac];
    if (land[0][ac]){
      ans++;
    }
    return ans;
  } else if (ar == 1 && br == 2){
    int ans = S2[bc - 1] - S2[ac];
    if (land[1][ac]){
      ans++;
    }
    return ans;
  } else {
    int ans = S12[bc - 1] - S12[ac];
    if (land[0][ac] || land[1][ac]){
      ans++;
    }
    return ans;
  }
}
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... |