# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1120864 | vjudge1 | Art Collections (BOI22_art) | C++17 | 3 ms | 848 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"
using namespace std;
int u[4001];
int p[4001];
int pp[4001];
int nn;
// int a[4001];
// int publish(vector<int>r){
// int j=0;
// for(int i=0;i<nn;i++){
// //cout<<r[i]<<" ";
// if(p[r[i]]<i){
// j+=i-p[r[i]];
// }
// }
// //cout<<" "<<j;
// //cout<<"\n";
// return j;
// }
// void answer(vector<int>r){
// for(int i=0;i<nn;i++){
// cout<<r[i]<<" ";
// }
// cout<<"\n";
// }
deque<int> merge(deque<int>v,deque<int>v1){
for(auto it : v1){
v.push_back(it);
}
return v;
}
vector<int>vv(deque <int>v){
vector<int>b;
for(auto it : v){
b.push_back(it);
}
return b;
}
void solve (int n){
nn=n;
deque<int>v;
for(int i=1;i<=n;i++){
v.push_back(i);
}
deque<int>v1,ans;
int k=publish(vv(v));
if(k==0){
answer(vv(v));
return;
}
while(publish(vv(merge(v,v1)))!=0){
k=publish(vv(merge(v,v1)));
ans=v;
for(int i=0;i<nn;i++){
v.push_back(v[0]);
v.pop_front();
int x=publish(vv(merge(v,v1)));
if(x<k){
k=x;
ans=v;
}
}
v=ans;
v1.push_front(v[(int)v.size()-1]);
v.pop_back();
}
// for(int i=0;i<n;i++){
// cout<<u[i]<<" ";
// }
// cout<<"\n";
answer(vv(merge(v,v1)));
}
// int main(){
// cin>>nn;
// for(int i=0;i<nn;i++){
// cin>>a[i];
// p[a[i]]=i;
// }
// solve(nn);
// }
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... |