This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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... |