# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
628645 | abdzag | 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<bits/stdc++.h>
#include "prison.h"
using namespace std;
std::vector<std::vector<int>> devise_strategy(int N) {
int n=N;
vector<vector<int>> ans(N+1);
ans[0][0]=1;
for(int i=1;i<=n;i++){
int next_index=12;
ans[0][i]=next_index*2+(((1<<next_index)&i)?1:2);
}
for(int i=1;i<=30;i++){
int current_index=i/2;
ans[i][0]=current_index%2;
for(int j=1;j<=n;j++){
if(j&(1<<current_index)<(i-1)%2){
if(ans[i][0])ans[i][j]=-1;
else ans[i][j]=-2;
}
else if(j&(1<<current_index)>(i-1)%2){
if(ans[i][0])ans[i][j]=-2;
else ans[i][j]=-1;
}
else {
int next_index=current_index-1;
ans[i][j]=next_index*2+(((1<<next_index)&i)?1:2);
}
}
}
return ans;
}
int main(){
return 0;
}