#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N = 2e5 + 42, INF = 1e18;
vector<int> id;
int n, curDiff = 1, grp[N];
int getNbDiff(int deb, int fin, int cible) {
cout << fin - deb + 1 << ' ' << cible+1;
for(int j = deb; j < fin; j++)
cout << ' ' << id[j] + 1;
cout << '\n';
cout.flush();
int ans;
cin >> ans;
return ans;
}
void dicho(int deb, int fin, int cible) {
if(deb + 1 == fin) {
grp[cible] = grp[id[deb]];
return;
}
int mid = (deb + fin) >> 1;
if(getNbDiff(deb, mid, cible) == mid - deb)
dicho(deb, mid, cible);
else
dicho(mid, fin, cible);
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n;
id.push_back(0);
for(int i = 1; i < n; i++) {
int ans = getNbDiff(0, curDiff, i);
if(ans == curDiff+1) {
grp[i] = curDiff;
curDiff++;
id.push_back(i);
} else {
dicho(0, curDiff, i);
}
}
cout << 0;
for(int i = 0; i < n; i++)
cout << ' ' << grp[i]+1;
cout.flush();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
208 KB |
Output is correct |
2 |
Correct |
5 ms |
208 KB |
Output is correct |
3 |
Correct |
4 ms |
208 KB |
Output is correct |
4 |
Correct |
3 ms |
208 KB |
Output is correct |
5 |
Correct |
6 ms |
208 KB |
Output is correct |
6 |
Correct |
3 ms |
208 KB |
Output is correct |
7 |
Correct |
6 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
208 KB |
Output is correct |
2 |
Correct |
10 ms |
208 KB |
Output is correct |
3 |
Correct |
3 ms |
324 KB |
Output is correct |
4 |
Correct |
3 ms |
324 KB |
Output is correct |
5 |
Correct |
5 ms |
208 KB |
Output is correct |
6 |
Correct |
4 ms |
208 KB |
Output is correct |
7 |
Correct |
9 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
6 ms |
208 KB |
Output is correct |
3 |
Correct |
8 ms |
208 KB |
Output is correct |
4 |
Correct |
2 ms |
320 KB |
Output is correct |
5 |
Correct |
8 ms |
208 KB |
Output is correct |
6 |
Correct |
4 ms |
208 KB |
Output is correct |
7 |
Correct |
6 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
208 KB |
Output is correct |
2 |
Correct |
6 ms |
208 KB |
Output is correct |
3 |
Correct |
4 ms |
324 KB |
Output is correct |
4 |
Correct |
2 ms |
208 KB |
Output is correct |
5 |
Correct |
5 ms |
208 KB |
Output is correct |
6 |
Correct |
4 ms |
208 KB |
Output is correct |
7 |
Correct |
6 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
208 KB |
Output is correct |
2 |
Correct |
8 ms |
208 KB |
Output is correct |
3 |
Correct |
6 ms |
208 KB |
Output is correct |
4 |
Correct |
5 ms |
208 KB |
Output is correct |
5 |
Correct |
5 ms |
320 KB |
Output is correct |
6 |
Correct |
4 ms |
336 KB |
Output is correct |
7 |
Correct |
3 ms |
208 KB |
Output is correct |