# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
774129 | jasmin | Prisoner Challenge (IOI22_prison) | C++17 | 0 ms | 0 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;
const int L=13;
std::vector<std::vector<int>> devise_strategy(int n) {
vector<vector<int> > ans(n+1, vector<int> (n+1, -1));
for(int a=0; a<=n; a++){
if(a&(1<<L)){
ans[0][a]=2
}
else{
ans[0][a]=1;
}
}
for(int x=1; x<=n; x++){
int i=L-(x-1)/4;
int bit=(x-1)%2;
if(x%4<=2){ // from A => look at B now
ans[x][0]=1;
for(int b=1; b<=n; b++){
int mom=b&(1<<i);
if(bit==0 && mom==1){
ans[x][b]=-1;
}
else if(bit==1 && mom==0){
ans[x][b]=-2;
}
else{
ans[x][b] = (L-i +1)*4 + 1;
if(mom==1) ans[x][]++;
}
}
}
else{ //from B, look at A now
ans[x][0]=0;
for(int a=1; a<=n; a++){
int mom = a&(1<<i);
ans[x][a] = (L-i)*4 + 1;
if(mom==1) ans[x][a]++;
}
}
}
return ans;
}