이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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-1)*2;
vii ret(x+1, vi(N+1));
ret[0][0] = 1;
REP(i,1,N){
if(i & (1ll<<(log-1))) ret[0][i] = 1;
else ret[0][i] = 2;
}
REP(i,1,x){
ll now = x-i;
ll bit = now/2+1;
ret[i][0] = bit%2;
REP(j,1,N){
ll op = 0;
if(j & (1ll<<bit)) op = 1;
if(op != now%2){
// op ... A
if(bit%2 == 0){
if(op) ret[i][j] = -2;
else ret[i][j] = -1;
}
// op ... B
else{
if(op) ret[i][j] = -1;
else ret[i][j] = -2;
}
}
else{
// op ... B
if(bit == 1){
if(j%2) ret[i][j] = -1;
else ret[i][j] = -2;
}
else{
ll nbit = bit-1;
ll next = (nbit-1)*2;
if(j & (1ll<<nbit)) next++;
ret[i][j] = x-next;
}
}
}
}
return ret;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |