# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1164175 | SmuggingSpun | 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>>s(40, vector<int>(n + 1));
fill(s[s[0][0] = 0].begin() + 1, s[0].end(), 13);
for(int i = 1; i < 14; i++){
s[i][0] = 0;
for(int j = 1; j <= n; i++){
if(1 << (i - 1) & j){
s[i][j] = i + 26;
}
else{
s[i][j] = i + 13;
}
}
}
for(int i = 14; i < 27; i++)[
s[i][0] = 1;
for(int j = 1; j <= n; j++){
if(1 << (i - 14) & j){
s[i][j] = -1;
}
else{
s[i][j] = i - 14;
}
}
]
for(int i = 27; i < 40; i++){
s[i][0] = 1;
for(int j = 1; j <= n; j++){
if(1 << (i - 27) & j){
s[i][j] = i - 27;
}
else{
s[i][j] = -2;
}
}
}
return s;
}