제출 #784764

#제출 시각아이디문제언어결과실행 시간메모리
784764thimote75죄수들의 도전 (IOI22_prison)C++17
56 / 100
11 ms1108 KiB
#include "prison.h"

#include <bits/stdc++.h>
using namespace std;

using idata = vector<int>;
using igrid = vector<idata>;

idata test_case (int height, int N) {
  idata result (N + 1);
  
  int watch = (max(height, 1) - 1) >> 1;
  int bytec = 12 - watch;
  int chesc = ((height + 1) >> 1) & 1;
  int byten = 12 - (watch + 1);
  
  result[0] = chesc;
  if (height == 0) {
    for (int u = 1; u <= N; u ++) {
      if ((1 << bytec) & u) result[u] = 2;
      else result[u] = 1;
    }
    return result;
  }

  int bytecOther = (height - 1) & 1;
  for (int u = 1; u <= N; u ++) {
    int bytecCurr = ((1 << bytec) & u) >> bytec;

    if (bytecCurr == bytecOther && byten != -1) {
      int bytecNext = ((1 << byten) & u) >> byten;
      result[u] = (height - bytecOther + 2 + bytecNext);
    } else if (bytecCurr == 0) {
      result[u] = -1 - chesc;
    } else {
      result[u] = -2 + chesc;
    }
  }

  return result;
}

igrid devise_strategy(int N) {
  igrid answer(27);

  for (int i = 0; i < 27; i ++)
    answer[i] = test_case(i, N);
  
  return answer;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...