#include <bits/stdc++.h>
using namespace std;
#define int long long
// #define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define nl "\n"
vector<int> vec(int start, int end){
vector<int> v;
for (int i=start; i<=end; i++) v.push_back(i);
return v;
}
int query(int k, vector<int> v){
cout << k << " ";
for (auto i : v) cout << i << " ";
cout << endl;
int c;
cin >> c;
return c;
}
void answer(vector<int> v){
cout << "0 ";
for (auto i : v) cout << i << " ";
cout << endl;
}
signed main(){
int n;
cin >> n;
vector<int> costumes;
// set person 1 to have costume 1
int curmax = 1;
costumes.push_back(1);
for (int i=2; i<=n; i++){
//for person i
int lower = 1, upper = i-1;
while(upper-lower>1){
int mid = (lower+upper)/2;
vector<int> to_query = vec(lower, mid);
to_query.push_back(i);
if(query(mid-lower+1, vec(lower, mid))==query(mid-lower+2, to_query)) upper = mid;
else lower = mid;
}
vector<int> too_query;
too_query.push_back(i);
too_query.push_back(lower);
if(query(2, too_query)==1) costumes.push_back(costumes[lower-1]);
else if (lower==upper){
costumes.push_back(curmax+1);
curmax++;
}
else{
too_query.pop_back();
too_query.push_back(upper);
if(query(2, too_query)==1) costumes.push_back(costumes[upper-1]);
else{
costumes.push_back(curmax+1);
curmax++;
}
}
}
answer(costumes);
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
600 KB |
Output is correct |
2 |
Correct |
8 ms |
344 KB |
Output is correct |
3 |
Correct |
11 ms |
344 KB |
Output is correct |
4 |
Correct |
13 ms |
452 KB |
Output is correct |
5 |
Correct |
10 ms |
692 KB |
Output is correct |
6 |
Correct |
11 ms |
344 KB |
Output is correct |
7 |
Correct |
14 ms |
600 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
13 ms |
600 KB |
Output is correct |
2 |
Correct |
13 ms |
444 KB |
Output is correct |
3 |
Correct |
9 ms |
600 KB |
Output is correct |
4 |
Correct |
11 ms |
344 KB |
Output is correct |
5 |
Correct |
9 ms |
344 KB |
Output is correct |
6 |
Correct |
9 ms |
444 KB |
Output is correct |
7 |
Correct |
10 ms |
600 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
344 KB |
Output is correct |
2 |
Correct |
9 ms |
344 KB |
Output is correct |
3 |
Correct |
15 ms |
852 KB |
Output is correct |
4 |
Correct |
10 ms |
344 KB |
Output is correct |
5 |
Correct |
13 ms |
344 KB |
Output is correct |
6 |
Correct |
10 ms |
344 KB |
Output is correct |
7 |
Correct |
9 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
344 KB |
Output is correct |
2 |
Correct |
12 ms |
856 KB |
Output is correct |
3 |
Correct |
9 ms |
356 KB |
Output is correct |
4 |
Correct |
11 ms |
344 KB |
Output is correct |
5 |
Correct |
9 ms |
600 KB |
Output is correct |
6 |
Correct |
11 ms |
600 KB |
Output is correct |
7 |
Correct |
11 ms |
600 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
344 KB |
Output is correct |
2 |
Correct |
10 ms |
344 KB |
Output is correct |
3 |
Correct |
14 ms |
600 KB |
Output is correct |
4 |
Correct |
14 ms |
344 KB |
Output is correct |
5 |
Correct |
14 ms |
344 KB |
Output is correct |
6 |
Correct |
16 ms |
592 KB |
Output is correct |
7 |
Correct |
12 ms |
444 KB |
Output is correct |