이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
int** devise_strategy(int N) {
  int maxX = 35;
  int** retvalue = new int*[maxX];
  rep(i,0,maxX) {
    retvalue[i] = new int[N+1];
    rep(j,0,N+1) retvalue[i][j] = 0;
  }
  bool checkB = true;
  int lenInterval = 4096;
  retvalue[0][0] = 0;
  rep(i,1,N+1) {
    retvalue[0][i] = 1 + i / lenInterval;
  }
  int p = 2;
  while(lenInterval != 1) {
    rep(prev,p*2-3,p*2-1) {
      int wasLowInterval = (prev&1) == 0;
      retvalue[prev][0] = checkB;
      rep(resp,1,N+1) {
        int temp = resp % (2*lenInterval);
        int isLowInterval = temp < lenInterval;
        if (wasLowInterval != isLowInterval) {
          // we know the answer
          if (wasLowInterval) {
            // the answer is in the current thing that was opened
            retvalue[prev][resp] = -1-checkB;
          }
          else {
            // the answer is in the opposite of what was opened
            retvalue[prev][resp] = -1-(1-checkB);
          }
          continue;
        }
        temp = resp % lenInterval;
        int newIntervalLen = lenInterval / 2;
        int isHiInterval = temp >= newIntervalLen;
        retvalue[prev][resp] = p*2-1 + isHiInterval;
      }
    }
    lenInterval /= 2;
    checkB = !checkB;
  }
  return retvalue;
}
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... |