#include "prison.h"
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define ff first
#define ss second
#define pb push_back
#define ll long long
#define ld long double
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
vector<vector<int>> devise_strategy(int n) {
vector<vector<int>> ansvec(25);
ansvec[0].pb(0);
for (int i=1;i<25;i++) {
if (i % 2 == 1) ansvec[i].pb(0);
else ansvec[i].pb(1);
}
for (int i=1;i<n+1;i++) {
if ((i >> 12) & 1) ansvec[0].pb(12);
else ansvec[0].pb(24);
}
for (int i=1;i<25;i++) {
int realval = i % 12;
if (realval == 0) realval = 12;
bool bit;
if (i > 12) bit = false;
else bit = true;
if (i % 2 == 0) {
for (int j=1;j<n+1;j++) {
if (bit == (bool)((j >> realval) & 1)) {
ansvec[i].pb(12*(((j >> (realval - 1)) & 1) ^ 1) + realval - 1);
} else if (!bit) {
ansvec[i].pb(-1);
} else {
ansvec[i].pb(-2);
}
}
} else {
for (int j=1;j<n+1;j++) {
if (bit == (bool)((j >> realval) & 1)) {
if (realval == 1) {
if (j & 1) {
ansvec[i].pb(-2);
} else {
ansvec[i].pb(-1);
}
} else {
ansvec[i].pb(12*(((j >> (realval - 1)) & 1) ^ 1) + realval - 1);
}
} else if (!bit) {
ansvec[i].pb(-2);
} else {
ansvec[i].pb(-1);
}
}
}
}
return ansvec;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |