이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
// komak!
#include "prison.h"
#include <bits/stdc++.h>
using namespace std;
#define debug(x) cerr << "(" << (#x) << "): " << (x) << endl;
#define all(x) x.begin(), x.end()
#define fi first
#define se second
#define mp make_pair
#define pb push_back
typedef long long ll;
const ll mod = 1e9 + 7;
const int maxn5 = 1e5 + 10;
int bt[maxn5][20];
std::vector<std::vector<int>> devise_strategy(int n) {
for(int i = 1; i <= n; i++){
int pt = 0, x = i;
while(x){
bt[i][pt] = x % 2;
pt++;
x /= 2;
}
}
vector <vector <int>> ret;
int x = 23;
ret.resize(x);
ret[0].pb(1);
for(int i = 1; i <= n; i++){
ret[0].pb(5 * 4 + bt[i][11] + bt[i][12] * 2);
}
for(int i = 1; i < x; i++){
int bl = i / 4, pre = i % 4;
ret[i].pb((bl % 2) ^ 1);
for(int j = 1; j <= n; j++){
int cur = bt[j][bl * 2 + 1] + bt[j][bl * 2 + 2] * 2;
if(!bl){
cur += (j & 1);
if(j % 8 == 0)
ret[i].pb(-((ret[i][0]) + 1));
else if(j % 8 == 7)
ret[i].pb(-((ret[i][0] ^ 1) + 1));
else if(pre < cur)
ret[i].pb(-((ret[i][0] ^ 1) + 1));
else if(pre > cur)
ret[i].pb(-((ret[i][0]) + 1));
else
ret[i].pb((j & 1) ? -2 : -1);
continue;
}
if(pre < cur)
ret[i].pb(-((ret[i][0] ^ 1) + 1));
else if(pre > cur)
ret[i].pb(-((ret[i][0]) + 1));
else{
if(bl == 1){
if(j % 8 == 0)
ret[i].pb(-((ret[i][0]) + 1));
else if(j % 8 == 7)
ret[i].pb(-((ret[i][0] ^ 1) + 1));
else
ret[i].pb(4 * (bl - 1) + bt[j][(bl - 1) * 2 + 1] + bt[j][(bl - 1) * 2 + 2] * 2 + (j % 2));
}
else
ret[i].pb(4 * (bl - 1) + bt[j][(bl - 1) * 2 + 1] + bt[j][(bl - 1) * 2 + 2] * 2);
}
}
}
return ret;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |