#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n;
cin>>n;
vector<int> v;
v.push_back(1);
int cur,prev=1;
for(int i=2;i<=n;i++){
cout<<i<<" ";
for(int j=1;j<=i;j++){
cout<<j<<" ";
}
cout<<endl;
cin>>cur;
if(cur>prev){
v.push_back(i);
prev=cur;
}
}
int ans[n];
memset(ans,0,sizeof(ans));
int x=1;
for(int i=0;i<cur;i++){
ans[v[i]-1]=x++;
}
x=0;
for(int i=1;i<=n;i++){
if(x<cur&&v[x]==i){
x++;
continue;
}
int l=0,r=cur-1;
while(l<r){
int m=(l+r)/2;
cout<<m-l+2<<" ";
for(int j=l;j<=m;j++){
cout<<v[j]<<" ";
}
cout<<i<<endl;
int k;
cin>>k;
if(k>m-l+1){
l=m+1;
}else{
r=m;
}
}
ans[i-1]=ans[v[l]-1];
}
cout<<"0 ";
for(int i=0;i<n;i++){
cout<<ans[i]<<" ";
}
cout<<endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
256 KB |
Output is correct |
2 |
Correct |
9 ms |
384 KB |
Output is correct |
3 |
Correct |
4 ms |
384 KB |
Output is correct |
4 |
Correct |
3 ms |
420 KB |
Output is correct |
5 |
Correct |
6 ms |
384 KB |
Output is correct |
6 |
Correct |
4 ms |
256 KB |
Output is correct |
7 |
Correct |
11 ms |
304 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7 ms |
256 KB |
Output is correct |
2 |
Correct |
9 ms |
512 KB |
Output is correct |
3 |
Correct |
8 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
256 KB |
Output is correct |
5 |
Correct |
10 ms |
256 KB |
Output is correct |
6 |
Correct |
11 ms |
384 KB |
Output is correct |
7 |
Correct |
12 ms |
256 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
16 ms |
256 KB |
Output is correct |
4 |
Correct |
4 ms |
340 KB |
Output is correct |
5 |
Correct |
9 ms |
256 KB |
Output is correct |
6 |
Correct |
11 ms |
256 KB |
Output is correct |
7 |
Correct |
14 ms |
256 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
6 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
304 KB |
Output is correct |
5 |
Correct |
8 ms |
256 KB |
Output is correct |
6 |
Correct |
7 ms |
256 KB |
Output is correct |
7 |
Correct |
8 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
9 ms |
384 KB |
Output is correct |
4 |
Correct |
9 ms |
304 KB |
Output is correct |
5 |
Correct |
9 ms |
256 KB |
Output is correct |
6 |
Correct |
6 ms |
256 KB |
Output is correct |
7 |
Correct |
7 ms |
256 KB |
Output is correct |