#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define MAXN (1000005)
int main() {
ios_base::sync_with_stdio(false);cin.tie(0);
ll N;
cin>>N;
vector<ll> unique; //exactly 1 representative from all different type of costumes
ll done[N + 1];
memset(done,-1,sizeof(done));
for(ll i = 1;i <= N;i++){ //1-indexed
cout<<unique.size() + 1<<" ";
for(auto u : unique){
cout<<u<<" ";
}
cout<<i<<endl;
ll diff;
cin>>diff;
if(diff == ll(unique.size()) + 1){
unique.push_back(i);
done[i] = unique.size();
}
}
vector<ll> ans;
for(ll i = 1;i <= N;i++){
if(done[i] != -1){
ans.push_back(done[i]);
continue;
}
ll L = 0;
ll R = unique.size() - 1;
while(L != R){
ll mid = (L + R) / 2;
cout<<(mid - L + 1) + 1<<" ";
for(ll j = L;j <= mid;j++){
cout<<unique[j]<<" ";
}
cout<<i<<endl;
ll diff;
cin>>diff;
if(diff <= (mid - L + 1)){
R = mid;
}else{
L = mid + 1;
}
}
ans.push_back(L + 1);
}
cout<<0<<" ";
for(auto u : ans){
cout<<u<<" ";
}
cout<<endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
456 KB |
Output is correct |
2 |
Correct |
3 ms |
452 KB |
Output is correct |
3 |
Correct |
2 ms |
452 KB |
Output is correct |
4 |
Correct |
2 ms |
704 KB |
Output is correct |
5 |
Correct |
2 ms |
456 KB |
Output is correct |
6 |
Correct |
1 ms |
456 KB |
Output is correct |
7 |
Correct |
4 ms |
452 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
456 KB |
Output is correct |
2 |
Correct |
3 ms |
448 KB |
Output is correct |
3 |
Correct |
2 ms |
452 KB |
Output is correct |
4 |
Correct |
2 ms |
452 KB |
Output is correct |
5 |
Correct |
3 ms |
456 KB |
Output is correct |
6 |
Correct |
3 ms |
452 KB |
Output is correct |
7 |
Correct |
3 ms |
452 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
448 KB |
Output is correct |
2 |
Correct |
2 ms |
448 KB |
Output is correct |
3 |
Correct |
3 ms |
452 KB |
Output is correct |
4 |
Correct |
2 ms |
708 KB |
Output is correct |
5 |
Correct |
3 ms |
456 KB |
Output is correct |
6 |
Correct |
3 ms |
456 KB |
Output is correct |
7 |
Correct |
3 ms |
452 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
452 KB |
Output is correct |
2 |
Correct |
3 ms |
452 KB |
Output is correct |
3 |
Correct |
3 ms |
456 KB |
Output is correct |
4 |
Correct |
2 ms |
452 KB |
Output is correct |
5 |
Correct |
3 ms |
448 KB |
Output is correct |
6 |
Correct |
3 ms |
456 KB |
Output is correct |
7 |
Correct |
4 ms |
452 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
456 KB |
Output is correct |
2 |
Correct |
4 ms |
452 KB |
Output is correct |
3 |
Correct |
3 ms |
448 KB |
Output is correct |
4 |
Correct |
3 ms |
452 KB |
Output is correct |
5 |
Correct |
3 ms |
448 KB |
Output is correct |
6 |
Correct |
3 ms |
448 KB |
Output is correct |
7 |
Correct |
2 ms |
460 KB |
Output is correct |