# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1201969 | bynix | Prisoner Challenge (IOI22_prison) | C++20 | 0 ms | 0 KiB |
#include "bits/stdc++.h"
#include "prison.h"
using namespace std;
vector<vector<int>> devise_strategy(int N){
vector<vector<int>> strategy;
for (int i = 0; i <= 24; i++) {
vector<int> J(N + 1);
if (i == 0){
J[0] = 1;
for (int j = 1; j <= N; j++) J[j] = encode(j, 8);
} else {
auto [p, pos] = decode(i);
J[0] = pos & 1;
for (int j = 1; j <= N; j++){
int c = b3(j, pos);
if (c < p) J[j] = -1 - pos % 2;
else if (c > p) J[j] = pos % 2 - 2;
else J[j] = encode(j, pos - 1);
}
}
strategy.push_back(J);
}
return strategy;
}