#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
#define pairll pair<ll,ll>
#define lpairll pair<ll,pairll>
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define repp(i,a,b) for(ll i = (a); i <= (b); i++)
#define repm(i, a, b) for (ll i = (a); i >= (b); i--)
#define repz(i, a, b) for (ll i = (a); i < (b); i++)
const long long MOD = 1e9+7, N = 1e5 + 5, M = 1e3+5, INF = 1e9;
ll tc = 1, n, m,k,cr[N],ans[N], col = 1;
string s, ye = "YES", no = "NO", nu;
void fastt(){
ios_base::sync_with_stdio(0);
cin.tie(NULL);
cout.tie(NULL);
}
ll ask(ll l, ll r, ll num){
cout << r-l+2 << " ";
repp(i,l,r) cout << cr[i] << " ";
cout << num << endl;
cin >> m;
return m;
}
void op(){
cout << "0 ";
repp(i,1,n) cout << ans[i] << " ";
cout << endl;
}
void input(){
cin >> n;
}
void solve(){
ans[1] = cr[1] = 1;
repp(i,2,n){
ll res = ask(1,col,i);
if(res > col){
col++;
cr[col] = i;
ans[i] = col;
continue;
}
ll l = 1, r = col;
while (l < r){
ll mid = (l+r)/2, res;
res = ask(l,mid,i);
if(res == mid-l+1) r = mid;
else l = mid+1;
}
ans[i] = l;
}
op();
}
int main(){
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
fastt();
while(tc--){
input();
solve();
}
}
/*
3
1 2 3
1 2 3
5
2 8 6 3 1
1 2 3 6 8
(n-1)/2
*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7 ms |
200 KB |
Output is correct |
2 |
Correct |
4 ms |
200 KB |
Output is correct |
3 |
Correct |
4 ms |
200 KB |
Output is correct |
4 |
Correct |
3 ms |
200 KB |
Output is correct |
5 |
Correct |
3 ms |
200 KB |
Output is correct |
6 |
Correct |
3 ms |
200 KB |
Output is correct |
7 |
Correct |
5 ms |
200 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
200 KB |
Output is correct |
2 |
Correct |
3 ms |
200 KB |
Output is correct |
3 |
Correct |
3 ms |
200 KB |
Output is correct |
4 |
Correct |
3 ms |
200 KB |
Output is correct |
5 |
Correct |
6 ms |
200 KB |
Output is correct |
6 |
Correct |
8 ms |
200 KB |
Output is correct |
7 |
Correct |
7 ms |
200 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
200 KB |
Output is correct |
2 |
Correct |
9 ms |
200 KB |
Output is correct |
3 |
Correct |
7 ms |
200 KB |
Output is correct |
4 |
Correct |
3 ms |
212 KB |
Output is correct |
5 |
Correct |
6 ms |
200 KB |
Output is correct |
6 |
Correct |
6 ms |
200 KB |
Output is correct |
7 |
Correct |
7 ms |
200 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
200 KB |
Output is correct |
2 |
Correct |
6 ms |
200 KB |
Output is correct |
3 |
Correct |
5 ms |
200 KB |
Output is correct |
4 |
Correct |
3 ms |
200 KB |
Output is correct |
5 |
Correct |
7 ms |
200 KB |
Output is correct |
6 |
Correct |
6 ms |
200 KB |
Output is correct |
7 |
Correct |
7 ms |
200 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
200 KB |
Output is correct |
2 |
Correct |
8 ms |
200 KB |
Output is correct |
3 |
Correct |
7 ms |
200 KB |
Output is correct |
4 |
Correct |
5 ms |
200 KB |
Output is correct |
5 |
Correct |
4 ms |
200 KB |
Output is correct |
6 |
Correct |
5 ms |
200 KB |
Output is correct |
7 |
Correct |
3 ms |
200 KB |
Output is correct |