# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
599860 | isaachew | Art Collections (BOI22_art) | C++17 | 1642 ms | 644 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 "art.h"
/*
Guess permutation from number of inverted (unordered) pairs
Maximum can be found
Find the minimum element by placing them at the start, then querying
n(n+1)/2 queries; satisfies ST2
Swap a block to know how many in one are less than the other
O(n log n) sort?
Score of x 1 2 ... N-2 N-1 N = score of original - sum(a_i>a_x) + sum(a_i<a_x)
sum(a_i>a_x) + sum(a_i<a_x) = x (quicksort-like comparison)
(newscore-curscore+x)/2
Already sorted a region; query
2n-2 solution; This gives 70? points
*/
void solve(int N) {
std::vector<int> cperm;
cperm.push_back(1);
for(int i=1;i<N;i++){
std::vector<int> curq(cperm);
for(int j=i;j<N;j++){
curq.push_back(j+1);
}
int q1=publish(curq);
curq.clear();
curq.push_back(i+1);
curq.insert(curq.end(),cperm.begin(),cperm.end());
for(int j=i+1;j<N;j++){
curq.push_back(j+1);
}
int q2=publish(curq);
int place=(q2-q1+i)/2;
//std::cout<<"place = "<<place<<'\n';
cperm.insert(cperm.begin()+place,i+1);
}
answer(cperm);
}
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... |