#include <bits/stdc++.h>
using namespace std;
int group[160] = {0, 1};
int entry[160] = {1}, en = 1, arr[160];
int party(int len, int*ap){
cout<<len<<" ";
for(int i=0;i<len;++i) cout<<ap[i]<<" ";
cout<<"\n";
int response;
cin>>response;
return response;
}
int bsearch(int s, int e, int tg){
int i, m, ans = s, ed;
while(s <= e){
m = (s + e) / 2;
ed = m - s + 1;
for(i=0;i<ed;++i) arr[i] = entry[s+i];
arr[ed] = tg;
if(party(ed+1, arr) < ed+1){
ans = m, e = m-1;
}
else s = m+1;
}
return group[entry[ans]];
}
int main(){
int N;
cin>>N;
for(int i=2;i<=N;++i){
entry[en] = i;
if(party(en+1, entry)==en+1){
group[i] = ++en;
continue;
}
int gnum = bsearch(0, en-1, i);
group[i] = gnum;
}
cout<<"0 ";
for(int i=1;i<=N;++i) cout<<group[i]<<" ";
cout<<"\n";
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
12 ms |
256 KB |
Output is correct |
2 |
Correct |
13 ms |
256 KB |
Output is correct |
3 |
Correct |
8 ms |
256 KB |
Output is correct |
4 |
Correct |
8 ms |
384 KB |
Output is correct |
5 |
Correct |
8 ms |
256 KB |
Output is correct |
6 |
Correct |
8 ms |
256 KB |
Output is correct |
7 |
Correct |
12 ms |
256 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
12 ms |
384 KB |
Output is correct |
2 |
Correct |
11 ms |
256 KB |
Output is correct |
3 |
Correct |
10 ms |
384 KB |
Output is correct |
4 |
Correct |
8 ms |
256 KB |
Output is correct |
5 |
Correct |
9 ms |
256 KB |
Output is correct |
6 |
Correct |
11 ms |
384 KB |
Output is correct |
7 |
Correct |
10 ms |
256 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7 ms |
384 KB |
Output is correct |
2 |
Correct |
9 ms |
256 KB |
Output is correct |
3 |
Correct |
13 ms |
384 KB |
Output is correct |
4 |
Correct |
8 ms |
256 KB |
Output is correct |
5 |
Correct |
11 ms |
256 KB |
Output is correct |
6 |
Correct |
9 ms |
256 KB |
Output is correct |
7 |
Correct |
14 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
256 KB |
Output is correct |
2 |
Correct |
10 ms |
256 KB |
Output is correct |
3 |
Correct |
9 ms |
288 KB |
Output is correct |
4 |
Correct |
7 ms |
256 KB |
Output is correct |
5 |
Correct |
10 ms |
256 KB |
Output is correct |
6 |
Correct |
11 ms |
256 KB |
Output is correct |
7 |
Correct |
12 ms |
256 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
9 ms |
256 KB |
Output is correct |
2 |
Correct |
13 ms |
256 KB |
Output is correct |
3 |
Correct |
12 ms |
256 KB |
Output is correct |
4 |
Correct |
11 ms |
256 KB |
Output is correct |
5 |
Correct |
12 ms |
256 KB |
Output is correct |
6 |
Correct |
9 ms |
256 KB |
Output is correct |
7 |
Correct |
8 ms |
256 KB |
Output is correct |