#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N=150;
int n,ans[N+5],mp[N+5][N+5];
int Ask(int l, int r){
if (mp[l][r]) return mp[l][r];
cout<<r-l+1<<' ';
for (int i=l;i<=r;++i) cout<<i<<' ';
cout<<"\n";
fflush(stdout);
int ans;
cin>>ans;
return mp[l][r]=ans;
}
void Solve(){
cin>>n;
for (int i=1;i<=n;++i)
for (int j=1;j<=n;++j)
mp[i][j]=0;
for (int i=1;i<=n;++i) ans[i]=i;
for (int i=n-1;i>=1;--i){
if (Ask(i,n)!=Ask(i+1,n)) continue;
int l=i+1,r=n;
while (l<r){
int md=l+r>>1;
if (Ask(i,md)==Ask(i+1,md)) r=md;
else l=md+1;
}
ans[i]=ans[l];
}
cout<<0<<' ';
for (int i=1;i<=n;++i) cout<<ans[i]<<' ';
cout<<"\n";
fflush(stdout);
}
signed main(){
int t=1;
// cin>>t;
while (t--) Solve();
}
Compilation message
carnival.cpp: In function 'void Solve()':
carnival.cpp:26:21: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
26 | int md=l+r>>1;
| ~^~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
8 ms |
600 KB |
Integer 133 violates the range [1, 11] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
10 ms |
600 KB |
Integer 142 violates the range [1, 5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
8 ms |
344 KB |
Integer 133 violates the range [1, 1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
9 ms |
600 KB |
Integer 143 violates the range [1, 4] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
13 ms |
600 KB |
Integer 149 violates the range [1, 2] |
2 |
Halted |
0 ms |
0 KB |
- |