#include <bits/stdc++.h>
#define int long long
#define fi first
#define se second
#define pb push_back
using namespace std;
//DONT LET SOMEONE CHEP YOUR CODE
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n;
cin >> n;
vector<vector<int>> subsets;
subsets.push_back({1});
subsets.push_back({1});
vector<int> query(n+1, 1);
for (int i = 2; i <= n; i++){
cout << i << ' ';
for (int j = 1; j <= i; j++){
cout << j << ' ';
}
cout << endl;
cin >> query[i];
if (query[i] > query[i-1]){
subsets.push_back({i});
}
else{
int l = 1, r = subsets.size()-1, ans = 0;
while (l <= r)
{
int mid = (l + r)/2, q;
vector<int> ask;
for (int j = l; j <= mid; j++){
for (int z: subsets[j]){
ask.push_back(z);
}
}
ask.push_back(i);
cout << ask.size() << ' ';
for (int z: ask){
cout << z << ' ';
}
cout << endl;
cin >> q;
if (q == mid - l + 2){
l = mid + 1;
}
else{
ans = mid;
r = mid - 1;
}
}
subsets[ans].push_back(i);
}
}
vector<int> ansf(n+1, 0);
int counter = 1;
for (auto i: subsets){
for (auto j: i){
ansf[j] = counter;
}
counter++;
}
cout << 0 << ' ';
for (int i = 1; i <= n; i++){
cout << ansf[i]-1 << ' ';
}
cout << endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
344 KB |
Output is correct |
2 |
Correct |
3 ms |
344 KB |
Output is correct |
3 |
Correct |
2 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
4 ms |
600 KB |
Output is correct |
6 |
Correct |
2 ms |
344 KB |
Output is correct |
7 |
Correct |
4 ms |
456 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
344 KB |
Output is correct |
2 |
Correct |
4 ms |
344 KB |
Output is correct |
3 |
Correct |
2 ms |
344 KB |
Output is correct |
4 |
Correct |
2 ms |
460 KB |
Output is correct |
5 |
Correct |
4 ms |
452 KB |
Output is correct |
6 |
Correct |
5 ms |
600 KB |
Output is correct |
7 |
Correct |
4 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
344 KB |
Output is correct |
2 |
Correct |
6 ms |
344 KB |
Output is correct |
3 |
Correct |
4 ms |
344 KB |
Output is correct |
4 |
Correct |
2 ms |
344 KB |
Output is correct |
5 |
Correct |
4 ms |
344 KB |
Output is correct |
6 |
Correct |
4 ms |
464 KB |
Output is correct |
7 |
Correct |
4 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
344 KB |
Output is correct |
2 |
Correct |
4 ms |
344 KB |
Output is correct |
3 |
Correct |
2 ms |
464 KB |
Output is correct |
4 |
Correct |
2 ms |
344 KB |
Output is correct |
5 |
Correct |
5 ms |
344 KB |
Output is correct |
6 |
Correct |
4 ms |
456 KB |
Output is correct |
7 |
Correct |
6 ms |
460 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
344 KB |
Output is correct |
2 |
Correct |
4 ms |
344 KB |
Output is correct |
3 |
Correct |
3 ms |
344 KB |
Output is correct |
4 |
Correct |
3 ms |
344 KB |
Output is correct |
5 |
Correct |
3 ms |
344 KB |
Output is correct |
6 |
Correct |
3 ms |
460 KB |
Output is correct |
7 |
Correct |
2 ms |
344 KB |
Output is correct |