# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1077152 | pcc | Prisoner Challenge (IOI22_prison) | C++17 | 545 ms | 2896 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 <vector>
#include <bits/stdc++.h>
using namespace std;
std::vector<std::vector<int>> devise_strategy(int N) {
int ans = 13*2*2;//nowbit,turn,bit of a
vector<vector<int>> re(ans,vector<int>(N+1,-1));
for(int i = 0;i<ans;i++){
int turn = ((i>>1)&1);
int tar = 12-(i>>2);
int bit = i&1;
if(turn == 0)re[i][0] = 0;
else re[i][0] = 1;
for(int j = 1;j<=N;j++){
if(turn == 0){
re[i][j] = (i/4*4)|2|((j>>tar)&1);
}
else{
if(bit != ((j>>tar)&1)){
if((j>>tar)&1)re[i][j] = -1;
else re[i][j] = -2;
}
else{
re[i][j] = ((i/4+1)*4);
if(re[i][j]>=ans)re[i][j] = -1;
}
}
}
}
for(int i = 0;i<ans;i++){
if(re[i][0] < 0)re[i][0] = 0;
for(int j = 0;j<=N;j++)assert(re[i][j]<ans);
cerr<<i<<":";
for(int j = 0;j<=N;j++)cerr<<re[i][j]<<' ';cerr<<endl;
}
cerr<<"INIT DONE!"<<endl;
return re;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |