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;
vector<vector<int>> devise_strategy(int N){
vector<vector<int>> ans;
for(int bit=12;bit;bit--) {
vector<int> curr(N+1);
curr[0]=0;
for(int i=1;i<=N;i++) {
if(i&(1<<bit))curr[i]=ans.size()+2;
else curr[i]=ans.size()+1;
}
ans.emplace_back(curr);
// If 0 at bit
curr[0]=1;
for(int i=1;i<=N;i++) {
if(i&(1<<bit))curr[i]=-1;
else curr[i]=ans.size()+2;
}
ans.emplace_back(curr);
// If 1 at bit
curr[0]=1;
for(int i=1;i<=N;i++) {
if(i&(1<<bit))curr[i]=ans.size()+1;
else curr[i]=-2;
}
ans.emplace_back(curr);
}
vector<int> curr(N+1);
curr[0]=0;
for(int i=1;i<=N;i++) {
if(i&1)curr[i]=-2;
else curr[i]=-1;
}
ans.emplace_back(curr);
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... |