# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
714389 | vjudge1 | Art Collections (BOI22_art) | C++17 | 129 ms | 332 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>
#include <bits/stdc++.h>
using namespace std;
void solve(int N){
vector<int> a(N);
for(int i=0 ; i<N ; i++){
a[i] = i + 1;
}
int now = publish(a);
while(now){
for(int i=N-1 ; i>=0 ; i--){
int l = 0 , r = i-1 , ind = -1;
while(l <= r){
int mid = (l + r) / 2;
swap(a[mid] , a[i]);
int deyer = publish(a);
//cout << deyer << ln;
swap(a[mid] , a[i]);
if(deyer <= now){
ind = mid;
r = mid - 1;
now = deyer;
}
else{
l = mid + 1;
}
}
l = i+1 , r = N-1;
while(l <= r){
int mid = (l + r) / 2;
swap(a[mid] , a[i]);
int deyer = publish(a);
//cout << deyer << ln;
swap(a[mid] , a[i]);
if(deyer <= now){
ind = mid;
l = mid + 1;
now = deyer;
}
else{
r = mid - 1;
}
}
if(ind != -1){
swap(a[ind] , a[i]);
}
}
}
answer(a);
}
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... |