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>
#define mp make_pair
#define eb emplace_back
#define fi first
#define se second
using namespace std;
using cd = complex <double>;
typedef pair <int, int> pii;
const long long Inf = 2e18;
const long long mod = 1e9 + 7;
const double Pi = acos(-1);
void Fastio()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
}
int n, cnt;
int a[155], cntt[155];
int main()
{
// Fastio();
cin >> n;
a[1] = 1;
cntt[1] = 1;
cnt = 1;
for(int i = 2; i <= n; i++)
{
int l = 1, r = i - 1;
cout << i << ' ';
for(int j = 1; j <= i; j++)
{
cout << j << ' ';
}
cout << endl;
int x;
cin >> x;
if(x == cnt + 1)
{
a[i] = cnt + 1;
cntt[i] = cntt[i - 1] + 1;
cnt++;
}
else
{
cntt[i] = cntt[i - 1];
while(l < r)
{
int mid = (r + l) >> 1;
cout << mid + 1 << ' ';
for(int i = 1; i <= mid; i++)
{
cout << i << ' ';
}
cout << i << endl;
int x;
cin >> x;
if(x == cntt[mid])
{
r = mid;
}
else
{
l = 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 |
---|
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... |