#include<bits/stdc++.h>
#include "prison.h"
using namespace std;
template<class T>void minimize(T& a, T b){
if(a > b){
a = b;
}
}
vector<vector<int>>devise_strategy(int n){
vector<vector<int>>s(27, vector<int>(n + 1));
s[0][0] = 0;
for(int i = 1; i <= n; i++){
s[0][i] = ((i & 4096) ? 2 : 1);
}
for(int i = 1; i < 27; i++){
bool on = (i & 1) ^ 1;
int bit = 12 - ((i - 1) >> 1);
if(bit & 1){
s[i][0] = 0;
for(int j = 1; j <= n; j++){
if(1 << bit & j){
s[i][j] = (on ? i + 2 : -2);
}
else{
s[i][j] = (on ? i + 2 : -1);
}
}
}
else{
s[i][0] = 1;
for(int j = 1; j <= n; j++){
if(1 << bit & j){
s[i][j] = (on ? i + 2 : -1);
}
else{
s[i][j] = (on ? -2 : i + 2);
}
}
}
}
for(int i = 0; i < 27; i++){
for(int j = 1; j <= n; j++){
minimize(s[i][j], 26);
}
}
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |