#include <bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define f first
#define s second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define epb emplace_back
using namespace std;
int GetDif(int l, int r){
cout << r - l + 1 << " ";
for(int i= l; i <= r; i++){
cout << i << ' ';
}
cout << "\n";
cout.flush();
int x; cin >> x;
return x;
}
int main(){
int n; cin >> n;
int c[n + 1];
fill(c + 1, c + n + 1, 0);
int cur = 1;
for(int i= 1;i <= n; i++){
if(c[i] == 0)c[i] = cur++;
int l = i , r = n + 1;
while(l + 1< r){
int mid = (l + r) / 2;
int v = GetDif(i, mid);
int u = GetDif(i + 1, mid);
if(u == v) r = mid;
else l = mid;
}
if(r != n + 1) c[r] = c[i];
}
cout << 0 << ' ';
for(int i = 1; i <= n; i++){
cout << c[i] << ' ';
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
17 ms |
208 KB |
Output is correct |
2 |
Correct |
19 ms |
208 KB |
Output is correct |
3 |
Correct |
20 ms |
208 KB |
Output is correct |
4 |
Correct |
26 ms |
208 KB |
Output is correct |
5 |
Correct |
13 ms |
208 KB |
Output is correct |
6 |
Correct |
14 ms |
208 KB |
Output is correct |
7 |
Correct |
17 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
17 ms |
208 KB |
Output is correct |
2 |
Correct |
16 ms |
208 KB |
Output is correct |
3 |
Correct |
20 ms |
208 KB |
Output is correct |
4 |
Correct |
22 ms |
208 KB |
Output is correct |
5 |
Correct |
16 ms |
208 KB |
Output is correct |
6 |
Correct |
14 ms |
208 KB |
Output is correct |
7 |
Correct |
18 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
15 ms |
208 KB |
Output is correct |
2 |
Correct |
17 ms |
208 KB |
Output is correct |
3 |
Correct |
21 ms |
208 KB |
Output is correct |
4 |
Correct |
26 ms |
208 KB |
Output is correct |
5 |
Correct |
17 ms |
208 KB |
Output is correct |
6 |
Correct |
22 ms |
208 KB |
Output is correct |
7 |
Correct |
23 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
18 ms |
208 KB |
Output is correct |
2 |
Correct |
9 ms |
208 KB |
Output is correct |
3 |
Correct |
19 ms |
208 KB |
Output is correct |
4 |
Correct |
37 ms |
208 KB |
Output is correct |
5 |
Correct |
20 ms |
208 KB |
Output is correct |
6 |
Correct |
34 ms |
208 KB |
Output is correct |
7 |
Correct |
22 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
15 ms |
208 KB |
Output is correct |
2 |
Correct |
17 ms |
208 KB |
Output is correct |
3 |
Correct |
27 ms |
208 KB |
Output is correct |
4 |
Correct |
32 ms |
208 KB |
Output is correct |
5 |
Correct |
18 ms |
208 KB |
Output is correct |
6 |
Correct |
23 ms |
208 KB |
Output is correct |
7 |
Correct |
33 ms |
208 KB |
Output is correct |