Submission #790965

#TimeUsernameProblemLanguageResultExecution timeMemory
790965penguinmanPrisoner Challenge (IOI22_prison)C++17
0 / 100
1 ms340 KiB
#include "prison.h"

#include <bits/stdc++.h>

using std::vector;
using std::string;
using std::cin;
using std::cout;
using ll = int;
using vi = vector<ll>;
using vii = vector<vi>;
using pii = std::pair<ll,ll>;
#define ln "\n"
#define rep(i,j,k) for(ll i=ll(j); i<ll(k); i++)
#define REP(i,j,k) for(ll i=ll(j); i<=ll(k); i++)
#define per(i,j,k) for(ll i=ll(j); i>=ll(k); i--)
#define all(a) a.begin(), a.end()
#define mp std::make_pair
#define pb emplace_back

std::vector<std::vector<int>> devise_strategy(int N) {
  constexpr ll log = 13;
  constexpr ll x = log*3-1;
  vii ret(x+1, vi(N+1));
  REP(i,0,log*3){
    ll now = x-i;
    ll bit = now/3;
    if(now%3 == 2){
      ret[i][0] = 0;
      REP(j,1,N){
        if(j & (1ll<<bit)) ret[i][j] = x-(bit*3+1);
        else ret[i][j] = x-(bit*3);
      }
    }
    else{
      ret[i][0] = 1;
      REP(j,1,N){
        ll A = now%3;
        ll B = 0;
        if(j & (1ll<<bit)) B = 1;
        if(A == B){
          ll nbit = bit-1;
          if(bit == 0) ret[i][j] = -1;
          else ret[i][j] = x-(nbit*3);
        }
        else if(A < B){
          ret[i][j] = -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...