# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
642177 | birthdaycake | 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>
#define int long long
#define endl '\n'
#define mod 1000000007
#define boost ios_base::sync_with_stdio(false), cin.tie(NULL);
using namespace std;
// odd has , even doesnt
// 0 check a
// 1 , 2 check b for 0
vector<vector<int>> devise_strategy(int N) {
vector<vector<int>>ans;
vector<int>d;
d.push_back(0);
for(int i = 1; i <= N; i++) {
if(i == 1){
d.push_back(-1);
continue;
}
else if(i == N){
d.push_back(-2);
continue;
}
if(i & (1 << (12))) d.push_back(1);
else d.push_back(2);
}
ans.push_back(d);
d.clear();
bool turn = 0; int cnt = 0;
for(int j = 1; cnt < 12 || turn == 0; j+=2){
if(turn){
// check a
cnt++;
d.push_back(0);
for(int i = 1; i <= N; i++){
if(i == 1) d.push_back(-1);
else if(i == N) d.push_back(-2);
else if(i & ((1 << cnt))) {
d.push_back(j + 2);
}
else {
d.push_back(j + 3);
}
}
ans.push_back(d);
d.clear();
d.push_back(0);
for(int i = 1; i <= N; i++){
if(i == 1) d.push_back(-1);
else if(i == N) d.push_back(-2);
else if(i & ((1 << cnt))){
d.push_back(j + 2);
}
else {
d.push_back(j + 3);
}
}
ans.push_back(d);
d.clear();
}else{
d.push_back(1);
for(int i = 1; i <= N; i++){
if(i == 1) d.push_back(-2);
else if(i == N) d.push_back(-1);
else if(i & ((1 << cnt))) d.push_back(j + 2);
else d.push_back(-2);
}
ans.push_back(d);
d.clear();
d.push_back(1);
for(int i = 1; i <= N; i++){
if(i == 1) d.push_back(-1);
else if(i == N) d.push_back(-2);
else if(i & ((1 << cnt))) d.push_back(-1);
else d.push_back(j + 3);
}
ans.push_back(d);
d.clear();
}
turn = !turn;
}
return ans;
}