#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
Next score can be computed as score of original - sum(a_i>a_x)
This has a count of N
*/
void solve(int N) {
std::vector<int> cperm;
cperm.push_back(1);
std::vector<int> curq;
for(int i=0;i<N;i++){
curq.push_back(i+1);
}
int ns=publish(curq);
for(int i=1;i<N;i++){
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-ns+i)/2;
ns-=(i-place);
cperm.insert(cperm.begin()+place,i+1);
}
answer(cperm);
}
Compilation message
events.cpp:1:10: fatal error: art.h: No such file or directory
1 | #include "art.h"
| ^~~~~~~
compilation terminated.