# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
579143 | Jarif_Rahman | Carnival (CEOI14_carnival) | C++17 | 51 ms | 312 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>
#define pb push_back
#define f first
#define sc second
using namespace std;
typedef long long int ll;
typedef string str;
int ask(vector<int> s){
cout << s.size() << " ";
for(int x: s) cout << x << " ";
cout << "\n";
int x; cin >> x;
return x;
}
int main(){
setbuf(stdout, NULL);
int n; cin >> n;
int c = 0;
vector<int> ans(n), s;
for(int i = 1; i <= n; i++){
s.pb(i);
if(ask(s) != c){
c++;
ans[i-1] = c;
continue;
}
s.pop_back();
int a = 0, b = c-1;
while(a < b){
int md = (a+b)/2;
vector<int> ss(s.begin(), s.begin()+md+1);
ss.pb(i);
if(ask(ss) == ss.size()) a = md+1;
else b = md;
}
ans[i-1] = a+1;
}
cout << "0 ";
for(int x: ans) cout << x << " ";
cout << "\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... |