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;
const int L=13;
std::vector<std::vector<int>> devise_strategy(int n) {
vector<vector<int> > ans(L*3+1, vector<int> (n+1, -1));
for(int x=0; x<=L*3; x++){
if(x%3==0){//look at A
ans[x][0]=0;
int l=L-(x/3);
for(int a=1; a<=n; a++){
if((a&(1<<l))==0){
ans[x][a]=x+1;
}
else{
ans[x][a]=x+2;
}
}
}
else{ //look at B
ans[x][0]=1;
int bita=x%3-1;
int l=L-(x/3);
for(int b=1; b<=n; b++){
int bitb = b&(1<<l);
if(bita<bitb){
ans[x][b]=-1;
}
else if(bita>bitb){
ans[x][b]=-2;
}
else{
ans[x][b] = (x/3 +1)*3;
}
}
}
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |