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;
#define int long long
#define sp << ' ' <<
#define nl << '\n'
vector<vector<int>> groups;
int currCount = 0, res;
int query(int x){
cout << x+1;
for(int i=0; i<=x; ++i) cout << ' ' << groups[i][0];
cout << endl;
int r; cin >> r;
return r;
}
signed main(){
cin.tie(0)->sync_with_stdio(0);
int n; cin >> n;
groups.push_back({1});
currCount = 1;
for(int i=2; i<=n; ++i){
cout << currCount+1;
for(int j=0; j<currCount; ++j) cout << ' ' << groups[j][0];
cout << ' ' << i << endl;
cin >> res;
if(res>currCount) groups.push_back({i}), ++currCount;
else{
int low = 0, high = currCount-1;
while(low<high){
int mid = (low+high)/2;
cout << mid+2;
for(int j=0; j<=mid; ++j) cout << ' ' << groups[j][0];
cout << ' ' << i << endl;
cin >> res;
if(res==mid+1) high = mid;
else low = mid+1;
}
groups[low].push_back(i);
}
}
cout << 0;
int ans[n+1];
for(int i=0; i<currCount; ++i){
for(int j=0; j<(int)groups[i].size(); ++j){
ans[groups[i][j]] = i+1;
}
}
for(int i=1; i<=n; ++i) cout << ' ' << ans[i];
cout << endl;
}
# | 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... |