# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
691016 | PagodePaiva | Art Collections (BOI22_art) | C++17 | 174 ms | 424 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"
#define pb push_back
#define all(v) v.begin(), v.end()
using namespace std;
int n;
vector <int> busca(vector <int> v, int k){
int l = 0, r = v.size();
int t = v.size();
while(l < r){
int mid = (l+r) >> 1;
if(mid == t){
l = t;
break;
}
vector <int> aux;
aux.pb(k);
aux.pb(v[mid]);
for(int i = 1;i <= n;i++){
if(i == k or i == v[mid]) continue;
aux.pb(i);
}
int x = publish(aux);
aux[0] = v[mid];
aux[1] = k;
int y = publish(aux);
if(x > y){
// v[mid] > k
r = mid;
}
else{
l = mid+1;
}
}
vector <int> res;
for(int i = 0;i < l;i++){
res.pb(v[i]);
}
res.pb(k);
for(int i = l;i < t;i++){
res.pb(v[i]);
}
return res;
}
void solve(int N){
n = N;
vector <int> v;
v.pb(1);
for(int i = 2;i <= n;i++){
v = busca(v, i);
}
reverse(all(v));
answer(v);
return;
}
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... |