제출 #1234700

#제출 시각아이디문제언어결과실행 시간메모리
1234700rxlfd314죄수들의 도전 (IOI22_prison)C++20
36.50 / 100
11 ms1604 KiB
#include "prison.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ari2 = array<int, 2>;
using ari3 = array<int, 3>;
using arl2 = array<ll, 2>;
using arl3 = array<ll, 3>;
template <class T> using vt = vector<T>;
#define all(x) begin(x), end(x)
#define size(x) (int((x).size()))
#define REP(a,b,c,d) for(int a=(b);(d)>0?a<=(c):a>=(c);a+=(d))
#define FOR(a,b,c) REP(a,b,c,1)
#define ROF(a,b,c) REP(a,b,c,-1)

vt<vt<int>> devise_strategy(int N) {
  const int LOG = 32 - __builtin_clz(N);
  vt<vt<int>> ret(3*LOG+1, vt<int>(N+1));
  ret[0][0] = 0;
  FOR(i, 1, N) {
    ret[0][i] = LOG + (i >> (LOG-1) & 1) * LOG;
  }
  // inspect A
  FOR(i, 2*LOG+1, 3*LOG) {
    ret[i][0] = 0;
    int bit = i - 2*LOG - 1;
    FOR(j, 1, N) {
      ret[i][j] = 1 + LOG * (j >> bit & 1) + bit;
    }
  }
  // inspect B
  FOR(i, 1, LOG) {
    ret[i][0] = 1;
    FOR(j, 1, N) {
      if (j >> (i-1) & 1)
        ret[i][j] = -1;
      else
        ret[i][j] = 2*LOG + i-1;
    }
  }
  FOR(i, LOG+1, 2*LOG) {
    ret[i][0] = 1;
    FOR(j, 1, N) {
      if (j >> (i-1-LOG) & 1)
        ret[i][j] = 2*LOG + i-LOG-1;
      else
        ret[i][j] = -2;
    }
  }
  return ret;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...