# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
806015 | Liudas | 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.
vector<vector<int>> devise_strategy(int N){
int x = 39;
vector<vector<int>> strat(x + 1, vector<int>(N+1));
for(int i = 0; i <= x; i ++){
if(i / 10 % 2 == 0){
strat[i][0] = 0;
}
else{
strat[i][0] = 1;
}
if(i / 10 % 2 == 0){
int bit = i % 10;
for(int j = 1; j <= N; j ++){
if(((1 << bit) & j)){
strat[i][j] = 30 + bit;
}
else{
strat[i][j] = 10 + bit;
}
}
}
else{
int bit = i % 10;
int sett = i / 20;
for(int j = 1; j <= N; j ++){
if(((1 << bit) & j) && sett){
strat[i][j] = 20 + bit-1;
}
else if (!sett && ((1 << bit) & j)){
strat[i][j] = -1;
}
else if (sett && !((1 << bit) & j)){
strat[i][j] = -2;
}
else{
strat[i][j] = bit-1;
}
}
}
}
return strat;
}