# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
622282 | rrrr10000 | Art Collections (BOI22_art) | C++17 | 0 ms | 0 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>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<bool> vb;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define REP(i,k,n) for(ll i=(ll)(k);i<(ll)(n);i++)
#define all(a) a.begin(),a.end()
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pb emplace_back
#define dupli(a) {sort(all(a));a.erase(unique(all(a)),a.end());}
template<class T> void out(T a){cout<<a<<endl;}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<endl;}
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
const ll inf=1001001001001001001;
void Solve(int N){
vi u,d;
vector<int> ask(N);rep(i,N)ask[i]=i+1;
ll f=publish(ask);
REP(i,1,N){
swap(ask[0],ask[i]);
ll g=publish(ask)-f;
if(g>0){
vi nu;
rep(j,g/2)nu.pb(u[j]);
nu.pb(i+1);
REP(j,g/2,u.size())nu.pb(u[j]);
u=nu;
}
else{
vi nd;
rep(j,(-g)/2)nd.pb(d[j]);
nd.pb(i+1);
REP(j,(-g)/2,d.size())nd.pb(d[j]);
d=nd;
}
swap(ask[0],ask[i]);
}
vector<int> res;
for(int i=d.size()-1;i>=0;i--)res.pb(d[i]);
res.pb(1);
rep(i,u.size())res.pb(u[i]);
}