#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(0);
int n;
cin >> n;
int a[n+1];
int coscount = 0, prev=0;
map<int, vector<int>> people;
for(int i=1; i<=n; i++){
cout << i << ' ';
for(int j=1; j<=i; j++){
cout << j << ' ';
}
cout << endl;
int nc;
cin >> nc;
if(nc != prev){ // costume worn by i is new
coscount++;
prev = nc;
a[i] = coscount;
}
else{ // costume is not new
int s=1, e=coscount;
while(s!=e){
int m=(s+e)/2;
vector<int> party;
for(int j=s; j<=m; j++){
for(auto k=people[j].begin(); k!=people[j].end(); k++){
party.push_back(*k);
}
}
cout << party.size()+1 << ' ';
for(auto j=party.begin(); j!=party.end(); j++){
cout << *j << ' ';
}
cout << i << ' ';
cout << endl;
int np;
cin >> np;
if(np == m-s+1){ //in range
e=m;
}
else{
s=m+1;
}
}
a[i] = s;
}
people[a[i]].push_back(i);
}
cout << "0 ";
for(int i=1; i<=n; i++){
cout << a[i] << ' ';
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
9 ms |
208 KB |
Output is correct |
2 |
Correct |
7 ms |
208 KB |
Output is correct |
3 |
Correct |
4 ms |
208 KB |
Output is correct |
4 |
Correct |
3 ms |
320 KB |
Output is correct |
5 |
Correct |
5 ms |
208 KB |
Output is correct |
6 |
Correct |
5 ms |
208 KB |
Output is correct |
7 |
Correct |
7 ms |
208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
208 KB |
Output is correct |
2 |
Correct |
7 ms |
208 KB |
Output is correct |
3 |
Correct |
3 ms |
208 KB |
Output is correct |
4 |
Correct |
4 ms |
444 KB |
Output is correct |
5 |
Correct |
11 ms |
316 KB |
Output is correct |
6 |
Correct |
9 ms |
208 KB |
Output is correct |
7 |
Correct |
8 ms |
208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
208 KB |
Output is correct |
2 |
Correct |
6 ms |
316 KB |
Output is correct |
3 |
Correct |
6 ms |
316 KB |
Output is correct |
4 |
Correct |
4 ms |
208 KB |
Output is correct |
5 |
Correct |
8 ms |
208 KB |
Output is correct |
6 |
Correct |
9 ms |
336 KB |
Output is correct |
7 |
Correct |
7 ms |
320 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
320 KB |
Output is correct |
2 |
Correct |
4 ms |
320 KB |
Output is correct |
3 |
Correct |
4 ms |
208 KB |
Output is correct |
4 |
Correct |
2 ms |
324 KB |
Output is correct |
5 |
Correct |
11 ms |
300 KB |
Output is correct |
6 |
Correct |
4 ms |
316 KB |
Output is correct |
7 |
Correct |
8 ms |
208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
320 KB |
Output is correct |
2 |
Correct |
11 ms |
316 KB |
Output is correct |
3 |
Correct |
4 ms |
312 KB |
Output is correct |
4 |
Correct |
6 ms |
328 KB |
Output is correct |
5 |
Correct |
6 ms |
208 KB |
Output is correct |
6 |
Correct |
5 ms |
208 KB |
Output is correct |
7 |
Correct |
3 ms |
320 KB |
Output is correct |