# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
579666 | jasmin | Art Collections (BOI22_art) | C++17 | 1644 ms | 704 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 publish(vector<int>& p){
for(auto e: p){
cout << e << " ";
}
cout << "\n" << flush;
int ans;
cin >> ans;
return ans;
}
void answer(vector<int> p){
cout << "answer: ";
for(auto e: p){
cout << e << " ";
}
cout << "\n";
}*/
void solve(int n){
vector<int> p(n);
iota(p.begin(), p.end(), 1);
vector<pair<int,int> > ans(n);
int a, b;
a=publish(p);
int first=a;
for(int i=1; i<=n-1; i++){
int last=p[0];
for(int j=0; j<n-1; j++){
p[j]=p[j+1];
}
p[n-1]=last;
b=publish(p);
ans[i-1]={b-a, i};
a=b;
}
ans[n-1]={first-a, n};
sort(ans.begin(), ans.end());
reverse(ans.begin(), ans.end());
for(int i=0; i<n; i++){
p[i]=ans[i].second;
}
answer(p);
}
/*signed main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
solve(n);
}*/
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... |