#include <bits/stdc++.h>
using namespace std;
int ans[155];
int first[155];
inline int query(int n){
cout << n << " ";
for (int i = 1; i <= n; i++) cout << i << " ";
cout << endl;
int ans;
cin >> ans;
return ans;
}
inline int query(int s, int e){
cout << e-s+1 << " ";
for (int i = s; i <= e; i++) cout << first[i] << " ";
cout << endl;
int ans;
cin >> ans;
return ans;
}
inline int query(int x, int s, int e){
cout << e-s+2 << " ";
cout << x << " ";
for (int i = s; i <= e; i++) cout << first[i] << " ";
cout << endl;
int ans;
cin >> ans;
return ans;
}
int main(){
cin >> n;
int cur = 1;
first[1] = 1;
ans[1] = 1;
int last = 1;
for (int i = 2; i <= n; i++){
int qf = query(i);
if (qf == last){
int lo = 1, hi = cur;
while (lo+1 < hi){
int mid = (lo+hi)/2;
if (query(i,lo,mid) == query(lo,mid)){
hi = mid;
}
else{
lo = mid;
}
}
if (lo + 1 == hi){
if (query(i,lo,lo) == 1){
hi = lo;
}
else lo = hi;
}
ans[i] = lo;
}
else{
cur++;
ans[i] = cur;
first[cur] = i;
}
last = qf;
}
cout << "0 ";
for (int i = 1; i <= n; i++) cout << ans[i] << " ";
cout << endl;
return 0;
}
Compilation message
carnival.cpp: In function 'int main()':
carnival.cpp:31:12: error: 'n' was not declared in this scope
cin >> n;
^
carnival.cpp:31:12: note: suggested alternative: 'yn'
cin >> n;
^
yn