#include<bits/stdc++.h>
#define endl '\n'
#define mp make_pair
#define pb push_back
#define all(x) x.begin(),x.end()
#define f first
#define s second
#define fore(i,l,r) for(int i = l; i < r;i++)
#define fo(i,n) fore(i,0,n)
#define ll long long
#define ii pair<int,int>
using namespace std;
using vi = vector<int>;
vector<int> arr;
map<int,int> idx;
int cnt = 1;
int main() {
int n;
cin >> n;arr.pb(1);idx[1]=1;
fore(i,2 ,n+1){
cout << i << " ";cout.flush();
fo(j,i){
cout << j+1 << " ";cout.flush();
}
// cout << endl; cout.flush();
int a; cin>>a;
if(a == cnt+1){
idx[cnt+1]=i;cnt++;arr.pb(cnt);
}else{
int l = 1, r= cnt;
while(l<=r){
int mid = (l+r)/2;
int posmid = (idx[mid]);
int k = (posmid-idx[l]+1);
cout << k+1 << " ";cout.flush();
set<int> howman;
fo(li,k){
cout << li+idx[l] << " ";cout.flush();
howman.insert(arr[li+idx[l]-1]);
}
cout << i<<" ";cout.flush();
// cout << endl; cout.flush();
int cn;cin >> cn;
if(cn==howman.size())r=mid-1;
else l = mid+1;
}
arr.pb(l);
}
}
cout << 0 << " ";cout.flush();
fo(i,n){
cout << arr[i] << " ";cout.flush();
}
}
Compilation message
carnival.cpp: In function 'int main()':
carnival.cpp:44:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::set<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
44 | if(cn==howman.size())r=mid-1;
| ~~^~~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
444 KB |
Output is correct |
2 |
Correct |
9 ms |
436 KB |
Output is correct |
3 |
Correct |
6 ms |
688 KB |
Output is correct |
4 |
Correct |
4 ms |
688 KB |
Output is correct |
5 |
Correct |
5 ms |
436 KB |
Output is correct |
6 |
Correct |
4 ms |
440 KB |
Output is correct |
7 |
Correct |
7 ms |
436 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
436 KB |
Output is correct |
2 |
Correct |
8 ms |
436 KB |
Output is correct |
3 |
Correct |
4 ms |
436 KB |
Output is correct |
4 |
Correct |
5 ms |
436 KB |
Output is correct |
5 |
Correct |
7 ms |
684 KB |
Output is correct |
6 |
Correct |
10 ms |
436 KB |
Output is correct |
7 |
Correct |
7 ms |
432 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
432 KB |
Output is correct |
2 |
Correct |
6 ms |
440 KB |
Output is correct |
3 |
Correct |
9 ms |
692 KB |
Output is correct |
4 |
Correct |
4 ms |
436 KB |
Output is correct |
5 |
Correct |
9 ms |
432 KB |
Output is correct |
6 |
Correct |
8 ms |
428 KB |
Output is correct |
7 |
Correct |
9 ms |
440 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
432 KB |
Output is correct |
2 |
Correct |
8 ms |
432 KB |
Output is correct |
3 |
Correct |
6 ms |
692 KB |
Output is correct |
4 |
Correct |
5 ms |
440 KB |
Output is correct |
5 |
Correct |
9 ms |
432 KB |
Output is correct |
6 |
Correct |
8 ms |
436 KB |
Output is correct |
7 |
Correct |
10 ms |
688 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
432 KB |
Output is correct |
2 |
Correct |
7 ms |
432 KB |
Output is correct |
3 |
Correct |
8 ms |
436 KB |
Output is correct |
4 |
Correct |
7 ms |
696 KB |
Output is correct |
5 |
Correct |
8 ms |
436 KB |
Output is correct |
6 |
Correct |
6 ms |
436 KB |
Output is correct |
7 |
Correct |
13 ms |
944 KB |
Output is correct |