# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1081538 | farica | 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;
std::vector<std::vector<int>> devise_strategy(int N) {
vector<vector<int>>ans(25, vector<int>(N+1, 0));
for(int i=0; i<25; ++i) {
s[i][0] = i%2;
for(int j=1; j<=N; ++j) {
if(i > 12) {
int bit = i - 12;
if((1LL<<bit) & j) {
--bit;
if(!bit) {
if(j%2) s[i][j] = -(i%2);
else s[i][j] = -((i+1)%2);
} else {
if((1LL<<bit) & j) s[i][j] = bit + 12;
else s[i][j] = bit;
}
} else s[i][j] = -((i+1)%2);
} else {
if((1LL<<i) & j) s[i][j] = -(i%2);
else {
int bit = i - 1;
if(!bit) {
if(j%2) s[i][j] = -(i%2);
else s[i][j] = -((i+1)%2);
} else {
if((1LL<<bit) & j) s[i][j] = bit + 12;
else s[i][j] = bit;
}
}
}
}
}
return ans;
}