# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
752679 | DeathIsAwe | Carnival (CEOI14_carnival) | C++17 | 8 ms | 208 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;
int binsearch(int c,vector<int>& uppl) {
int org=c;
int a=0,b=c/2,output;
while (a!=b) {
cout << c-b+1 << ' ';
for (int i=b;i<c;i++) {
cout << uppl[i] << ' ';
}
cout << uppl[org] << '\n'; cin >> output;
if (output<c-b+1) {
a=b; b=(c-a)/2+a;
} else {
c=b; b=(c-a)/2+a;
}
}
return b;
}
int main() {
vector<vector<int>> samekind(151); int n,output; cin >> n;
vector<int> ans(n+1);
vector<int> uppl;
for (int i=0;i<n;i++) {
uppl.push_back(i+1);
}
int canceler=0,searchres;
for (int i=0;i<n;i++) {
cout << i+1-canceler << ' ';
for (int j=0;j<i-canceler+1;j++) {
cout << uppl[j] << ' ';
}
cout << '\n';
cin >> output;
if (output<i+1-canceler) {
searchres=binsearch(i-canceler,uppl);
samekind[uppl[searchres]].push_back(uppl[i-canceler]);
uppl.erase(uppl.begin()+i-canceler);
canceler+=1;
}
}
for (int i=0;i<uppl.size();i++) {
ans[uppl[i]]=i+1;
for (auto &j: samekind[uppl[i]]) {
ans[j]=i+1;
}
}
cout << 0 << ' ';
for (int i=1;i<n+1;i++) {
cout << ans[i] << ' ';
}
return 0;
}
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... |