This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |