# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
579685 | Josia | Art Collections (BOI22_art) | C++17 | 1600 ms | 712 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 <bits/stdc++.h>
#include "art.h"
using namespace std;
int query(vector<int> a) {
for (int &i: a) i++;
return publish(a);
}
void solve(int n) {
vector<int> a;
for (int i = 0; i<n; i++) {
a.push_back(i);
}
vector<int> res(n*2, -1);
res[n-1] = 0;
int lastpos = n-1;
for (int i = 1; i<n; i++) {
swap(a[i-1], a[0]);
swap(a[i], a[n-1]);
int one = query(a);
swap(a[n-1], a[0]);
int two = query(a);
swap(a[n-1], a[0]);
swap(a[i], a[n-1]);
swap(a[i-1], a[0]);
res[lastpos+(abs(one-two)/2 +1) * ((one-two)/abs(one-two))] = i;
lastpos = lastpos+(abs(one-two)/2 +1) * ((one-two)/abs(one-two));
}
reverse(res.begin(), res.end());
vector<int> ret;
for (int i: res) {
if (i != -1) {
ret.push_back(i+1);
}
}
answer(ret);
}
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... |