이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "koala.h"
int minValue(int N, int W) {
int B[100] = {}, R[100] = {};
B[0] = 1;
playRound(B, R);
for (int i = 1; i < N; ++i) {
if (R[i] == 0) {
return i;
}
}
return 0;
}
int maxValue(int N, int W) {
int B[100] = {}, R[100] = {};
std::vector<int> cand(N);
std::iota(cand.begin(), cand.end(), 0);
while (cand.size() > 1) {
const int x = W / (int)cand.size();
for (const int i : cand) {
B[i] = x;
}
playRound(B, R);
std::vector<int> next;
for (const int i : cand) {
if (B[i] < R[i]) {
next.push_back(i);
}
B[i] = 0;
}
cand = std::move(next);
}
return cand[0];
}
int greaterValue(int N, int W) {
int B[100] = {}, R[100] = {};
const auto put_and_play = [&](const int x) {
B[0] = B[1] = x;
playRound(B, R);
return (B[0] < R[0]) + (B[1] < R[1]);
};
const int a = put_and_play(4);
if (a == 2) {
put_and_play(8);
} else if (a == 0) {
const int b = put_and_play(2);
if (b == 0) {
put_and_play(1);
}
}
return B[1] < R[1];
}
void allValues(int N, int W, int *P) {
int B[100] = {}, R[100] = {};
if (W == 2*N) {
std::vector<int> ord(N);
std::iota(ord.begin(), ord.end(), 0);
std::sort(ord.begin(), ord.end(), [&](const int i, const int j) {
B[i] = B[j] = N;
playRound(B, R);
const bool ret = B[j] < R[j];
B[i] = B[j] = 0;
return ret;
});
for (int i = 0; i < N; ++i) {
P[ord[i]] = i + 1;
}
} else {
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |