# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
721422 | FatihSolak | Carnival (CEOI14_carnival) | C++17 | 10 ms | 320 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 N 200005
using namespace std;
int ans[N];
void solve(){
int n;
cin >> n;
auto ask = [&](vector<int> v){
cout << v.size() << ' ';
for(auto u:v){
cout << u << ' ';
}
cout << endl;
int ret;
cin >> ret;
return ret;
};
auto print = [&](){
cout << "0 ";
for(int i = 1;i<=n;i++){
cout << ans[i] << ' ';
}
cout << endl;
};
int cnt = 0;
vector<int> v;
for(int i = 1;i<=n;i++){
v.push_back(i);
if(ask(v) == v.size()){
ans[i] = ++cnt;
continue;
}
v.pop_back();
auto tmp = v;
while(tmp.size() > 1){
vector<int> a;
while(a.size() < tmp.size()){
a.push_back(tmp.back());
tmp.pop_back();
}
a.push_back(i);
if(ask(a) != a.size()){
a.pop_back();
tmp = a;
}
}
ans[i] = ans[tmp[0]];
}
print();
}
int main(){
int t=1;
//cin>>t;
while(t--){
solve();
}
#ifdef Local
cout<<endl<<fixed<<setprecision(2)<<1000.0 * clock() / CLOCKS_PER_SEC<< " milliseconds ";
#endif
}
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... |