#include "prison.h"
#include <vector>
#include<bits/stdc++.h>
using namespace std;
int getbit(int x){
for(int i = 13; i >= 0; i--){
if(x & (1 << i)){
return i;
}
}
return 01;
}
std::vector<std::vector<int>> devise_strategy(int N) {
vector<vector<int>> ans(36);
ans[0].push_back(0);
ans[0].push_back(-1);
for(int i = 2; i <= N; ++i){
int call = getbit(i);
ans[0].push_back((12 + (call >= 12? 12:0)));
}
ans[1].push_back(1);
for(int i = 1; i <= N; ++i){
bool on = (i & 2);
if(on){
ans[1].push_back(-1);
}else{
if(i & 1){
ans[1].push_back(-1);
}else{
ans[1].push_back(-2);
}
}
}
ans[13].push_back(1);
for(int i = 1; i <= N; ++i){
bool on = (i & 2);
if(!on){
ans[13].push_back(-2);
}else{
if(i & 1){
ans[13].push_back(-1);
}else{
ans[13].push_back(-2);
}
}
}
for(int i = 2; i <= 12; ++i){
ans[i].push_back(1);
for(int j = 1; j <= N; ++j){
bool on = (j & (1 << i));
if(on){
ans[i].push_back(-1);
}else{
ans[i].push_back(24 + i - 1);
}
}
}
for(int i = 14; i <= 24; ++i){
ans[i].push_back(1);
for(int j = 1; j <= N; ++j){
bool on = (j & (1 << (i - 12)));
if(!on){
ans[i].push_back(-2);
}else{
ans[i].push_back(24 + i - 13);
}
}
}
for(int i = 25; i <= 35; ++i){
ans[i].push_back(0);
for(int j = 1; j <= N; ++j){
bool on = j & (1 << (i - 24));
if(on){
ans[i].push_back(i - 24 + 12);
}else{
ans[i].push_back(i - 24);
}
}
}
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... |