# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
982391 | Aiperiii | Art Collections (BOI22_art) | C++17 | 579 ms | 1336 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 ff first
#define ss second
#define pb push_back
#define all(x) x.begin(),x.end()
using namespace std;
vector <int> ans;
void merge(int l, int r){
if(l==r)return;
int md=(l+r)/2;
merge(l,md);
merge(md+1,r);
vector <int> ord;
int p1=l,p2=md+1;
int cur=publish(ans);
while(p1<=md && p2<=r){
swap(ans[p1],ans[p2]);
int nw=publish(ans);
swap(ans[p1],ans[p2]);
if(nw>cur){
ord.pb(ans[p1]);
p1++;
}
else{
ord.pb(ans[p2]);
p2++;
cur=nw;
}
}
for(int i=p1;i<=md;i++)ord.pb(ans[i]);
for(int i=p2;i<=r;i++)ord.pb(ans[i]);
int pos=0;
for(int i=l;i<=r;i++){
ans[i]=ord[pos];
pos++;
}
}
void solve(int N){
for(int i=1;i<=N;i++)ans.pb(i);
merge(0,N-1);
answer(ans);
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... |