제출 #829399

#제출 시각아이디문제언어결과실행 시간메모리
829399errayPrisoner Challenge (IOI22_prison)C++17
65 / 100
10 ms1156 KiB
#include "prison.h"

#include <vector>
#include <bits/stdc++.h>

using namespace std;

#ifdef DEBUG 
  #include "/home/eagle/ioi22/debug.h"
#else 
  #define debug(...) void(37)
#endif


std::vector<std::vector<int>> devise_strategy(int N) {
  int M = 24;
  const int BIT = 12;
  vector<vector<int>> S(M + 1, vector<int>(N + 1));
  S[0][0] = 0;
  for (int i = 1; i <= N; ++i) {
    S[0][i] = 1 + (i >= (1 << BIT));
  }
  debug(S[0]);
  for (int i = 1; i <= M; ++i) {
    int bit = (1 + BIT - (i + 1) / 2);
    S[i][0] = 1 ^ (bit % 2);
    bool val = (i + 1) % 2;
    debug(i, bit, val);
    for (int j = 1; j <= N; ++j) {
      int my_val = (j >> bit) & 1;
      if (my_val != val) {
        S[i][j] = ((S[i][0] ^ (my_val < val)) ? -1 : -2);
        continue;
      }
      if (bit == 1) {
        S[i][j] = (((j % 2 == 0) ^ S[i][0]) ? -1 : -2);
        continue;
      }
      S[i][j] = 3 + 2 * (BIT - bit) + ((j >> (bit - 1)) % 2);
    }
    //debug(S[i]);
  }
  return S;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...