이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "prison.h"
#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> devise_strategy(int N) {
vector<int> seq(13, 2);
vector<vector<int>> strategy(28, vector<int>(N + 1));
for (int i = 0; i < 28; i++) {
int bit = (i + 1) / 2;
int player = (bit % 2 == 0 ? 0 : 1);
strategy[i][0] = player;
for (int j = 1; j <= N; j++) {
if (i >= 27) {
strategy[i][j] = 0;
continue;
}
if (player == 0) {
if (i == 0) {
strategy[i][j] = 1 + (j >> (12 - bit) & 1);
} else {
int he = 1 - (i % 2);
int me = (j >> (12 - (bit - 1)) & 1);
int my_bag = (player == 0 ? 1 : 2);
int his_bag = (my_bag ^ 1 ^ 2);
strategy[i][j] = (me < he ? -my_bag : (me > he ? -his_bag : i + (i % 2) + 1 + (j >> (12 - bit) & 1)));
}
} else {
assert(i > 0);
int he = 1 - (i % 2);
int me = (j >> (12 - (bit - 1)) & 1);
int my_bag = (player == 0 ? 1 : 2);
int his_bag = (my_bag ^ 1 ^ 2);
strategy[i][j] = (me < he ? -my_bag : (me > he ? -his_bag : i + (i % 2) + 1 + (j >> (12 - bit) & 1)));
}
}
}
return strategy;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |