# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1055995 | tolbi | Prisoner Challenge (IOI22_prison) | C++17 | 7 ms | 1116 KiB |
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 namespace std;
#define tol(bi) (1ll<<((int)(bi)))
constexpr int LOG = 13;
vector<vector<int>> devise_strategy(int N) {
vector<vector<int>> ret(LOG*2-1,vector<int>(N+1));
int ind = -1;
for (int i = 0; i < LOG*2; i++){
if (i==1) continue;
ind++;
int curbit = i>>1;
int bionceki = i&1;
int oncekibit = (LOG-1)-curbit+1;
int bubit = (LOG-1)-curbit;
for (int j = 1; j <= N; j++){
if ((curbit&1)==0){
ret[ind][0]=0;
if (!!(j&tol(oncekibit)) != bionceki){
if (bionceki) ret[ind][j]=-1;
else ret[ind][j]=-2;
}
else {
if (bubit==0) ret[ind][j]=(j&tol(bubit))?-2:-1;
else ret[ind][j]=curbit*2+2+(!!(j&tol(bubit)));
}
}
else {
ret[ind][0]=1;
if (!!(j&tol(oncekibit)) != bionceki){
if (bionceki) ret[ind][j]=-2;
else ret[ind][j]=-1;
}
else {
if (bubit==0) ret[ind][j]=(j&tol(bubit))?-1:-2;
else ret[ind][j]=curbit*2+2+(!!(j&tol(bubit)));
}
}
}
}
for (int i = 0; i < ret.size(); i++){
for (int j = 1; j < ret[i].size(); j++){
if (ret[i][j]>=1) ret[i][j]--;
}
}
return ret;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |