# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
754048 | jakobrs | Art Collections (BOI22_art) | C++17 | 1568 ms | 680 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <vector>
#include <algorithm>
int publish(std::vector<int> R);
void answer(std::vector<int> R);
void solve(int N) {
// Used for comparisons
std::vector<int> R;
std::vector<int> ans(N, -1);
for (int i = 1; i <= N; i++) {
R.push_back(i);
}
int prev = publish(R);
for (int i = N; i >= 2; i--) {
R.pop_back();
R.insert(R.begin(), i);
int measured = publish(R);
// measured = prev - ob + nb
// ob = N - nb - 1
// nb = intended position i think ???
// measured - prev = nb - ob = nb - N + nb + 1
// measured - prev + N - 1 = 2 nb
int pos = ((measured - prev) + N - 1)/2;
ans[pos] = i;
prev = measured;
}
for (int i = 0; i < N; i++) {
if (ans[i] == -1) {
ans[i] = 1;
}
}
answer(ans);
}
Compilation message (stderr)
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |