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;
#define pb push_back
#define all(x) x.begin(),x.end()
#define ll long long int
#define en cout << '\n'
#define pi pair<int,int>
#define vi vector<int>
#define ff first
#define ss second
std::vector<std::vector<int>> devise_strategy(int n) {
vector<vector<int>> ans(27, vector<int>(n+1, 0));
ans[0][0] = 0;
for(int i = 1; i <= n; ++i){
ans[0][i] = (i&(4096)) ? 2 : 1;
}
int tot = 13;
for(int i = 1; i <= 26; ++ i){
int bit = tot-(i+1)/2;
// cout << bit << ' ';
int cur;
if(bit % 2 == 1){
ans[i][0] = 0;
cur = 1;
}else{
ans[i][0] = 1;
cur = 2;
}
int nx = (1<<(bit-1));
for(int j = 1; j <= n; ++j){
if((j&(1<<bit))){
if(i % 2 == 1){
ans[i][j] = -(3-cur);
}else{
if(j&nx){
ans[i][j] = i + 2;
}else{
ans[i][j] = i + 1;
}
}
}else{
if(i % 2 == 0){
ans[i][j] = -cur;
}else{
if(j&(nx)){
ans[i][j] = i + 3;
}else{
ans[i][j] = i + 2;
}
}
}
}
}
for(auto &v: ans){
for(auto &u: v){
if(u > 26) u = 1;
}
}
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... |