# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
599862 | isaachew | Art Collections (BOI22_art) | C++17 | 1560 ms | 676 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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);
}
컴파일 시 표준 에러 (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... |