# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1007479 | kukuk | 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>
#include "art.h"
using namespace std;
deque<int> dq;
vector<pair<int,int>> v;
vector<int> ans;
void solve(int N){
for(int i = 1; i <= N; i++){
dq.push_back(i);
}
int cyc[2010];
for(int i = 0; i < N; i++){
int val = publish(dq);
cyc[i] = val;
int rn = dq.front();
dq.pop_front();
dq.push_back(rn);
}
cyc[N] = cyc[0];
for(int i = 0; i < N; i++){
v.push_back({cyc[i+1]-cyc[i], i});
}
sort(v.begin(), v.end());
for(int i = 0; i < N; i++){
ans.push_back(v[i].second);
}
answer(ans);
}