#include <bits/stdc++.h>
using namespace std;
int main(){
cin.tie(0) -> ios_base::sync_with_stdio(0);
int n;
cin >> n;
vector<int> a(n + 1);
auto ask = [&](int l, int r) -> int {
cout << r - l + 1 << " ";
for(int i=l;i<=r;i++)
{
cout << i << " ";
}
cout << endl;
int ret;
cin >> ret;
return ret;
};
a[1] = 1;
for(int i=2,cur=1;i<=n;i++)
{
if(ask(1, i) != ask(1, i-1))
{
a[i] = ++cur;
continue;
}
int l = 1, r = i - 1;
while(l < r)
{
int mid = (l + r + 1) / 2;
if(ask(mid, i-1) == ask(mid, i))
{
l = mid;
}
else
{
r = mid - 1;
}
}
a[i] = a[l];
}
cout << "0 ";
for(int i=1;i<=n;i++)
{
cout << a[i] << " ";
}
cout << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
22 ms |
200 KB |
Output is correct |
2 |
Correct |
28 ms |
200 KB |
Output is correct |
3 |
Correct |
10 ms |
200 KB |
Output is correct |
4 |
Correct |
6 ms |
200 KB |
Output is correct |
5 |
Correct |
19 ms |
200 KB |
Output is correct |
6 |
Correct |
22 ms |
200 KB |
Output is correct |
7 |
Correct |
19 ms |
200 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
20 ms |
200 KB |
Output is correct |
2 |
Correct |
24 ms |
200 KB |
Output is correct |
3 |
Correct |
10 ms |
200 KB |
Output is correct |
4 |
Correct |
6 ms |
200 KB |
Output is correct |
5 |
Correct |
21 ms |
200 KB |
Output is correct |
6 |
Correct |
21 ms |
200 KB |
Output is correct |
7 |
Correct |
22 ms |
200 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
20 ms |
204 KB |
Output is correct |
2 |
Correct |
19 ms |
200 KB |
Output is correct |
3 |
Correct |
17 ms |
200 KB |
Output is correct |
4 |
Correct |
7 ms |
200 KB |
Output is correct |
5 |
Correct |
17 ms |
220 KB |
Output is correct |
6 |
Correct |
18 ms |
200 KB |
Output is correct |
7 |
Correct |
20 ms |
200 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
24 ms |
200 KB |
Output is correct |
2 |
Correct |
21 ms |
200 KB |
Output is correct |
3 |
Correct |
10 ms |
200 KB |
Output is correct |
4 |
Correct |
6 ms |
200 KB |
Output is correct |
5 |
Correct |
20 ms |
200 KB |
Output is correct |
6 |
Correct |
16 ms |
212 KB |
Output is correct |
7 |
Correct |
21 ms |
200 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
21 ms |
200 KB |
Output is correct |
2 |
Correct |
24 ms |
200 KB |
Output is correct |
3 |
Correct |
17 ms |
200 KB |
Output is correct |
4 |
Correct |
11 ms |
200 KB |
Output is correct |
5 |
Correct |
22 ms |
200 KB |
Output is correct |
6 |
Correct |
11 ms |
200 KB |
Output is correct |
7 |
Correct |
7 ms |
200 KB |
Output is correct |