#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] = l;
}
cout << "0 ";
for(int i=1;i<=n;i++)
{
cout << a[i] << " ";
}
cout << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
18 ms |
200 KB |
Integer 12 violates the range [1, 11] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
24 ms |
200 KB |
Integer 7 violates the range [1, 5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
11 ms |
200 KB |
Integer 2 violates the range [1, 1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
23 ms |
200 KB |
Integer 5 violates the range [1, 4] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
23 ms |
200 KB |
Integer 3 violates the range [1, 2] |
2 |
Halted |
0 ms |
0 KB |
- |