#include <bits/stdc++.h>
//#include <fstream>
///#define endl '\n'
#define mod 10007
#define INF 100000000
#define ll long long
//ofstream fout("split.out");
//ifstream fin("split.in");
//#define cin fin
//#define cout fout
using namespace std;
int main()
{
ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0);
int n; cin >> n;
int ans[n+1] = {};
int cnt = 1;
vector<int> v;
int y;
cout << 2 << ' ' << 1 << ' ' << 2 << endl;
cin >> y;
if(y == 1)
{
ans[1] = cnt;
ans[2] = cnt;
cnt++;
v.push_back(1);
}
else
{
ans[1] = 1;
ans[2] = 2;
cnt += 2;
v.push_back(1);
v.push_back(2);
}
for(int i = 3; i <= n; i++)
{
int l = 0, r = v.size()-1;
while(l <= r)
{
int mid = (l+r-1)/2;
int a = -1, b = -1;
if(mid-l+1 != 0)
{
cout << mid-l+2 << ' ';
for(int j = l; j <= mid; j++)
{
cout << v[j] << ' ';
}
cout << i << ' ';
cout << endl;
cin >> a;
}
if(r-mid != 0)
{
cout << r-mid+1 << ' ';
for(int j = mid+1; j <= r; j++)
{
cout << v[j] << ' ';
}
cout << i << ' ';
cout << endl;
cin >> b;
}
if(a == mid-l+1)
{
if(mid-l+1 == 1)
{
ans[i] = ans[v[mid]];
break;
}
r = mid;
}
else if(b == r-mid)
{
if(r-mid == 1)
{
ans[i] = ans[v[r]];
break;
}
l = mid+1;
}
else
{
ans[i] = cnt;
cnt++;
v.push_back(i);
break;
}
}
}
cout << 0 << ' ';
for(int i = 1; i <= n; i++)
{
cout << ans[i] << ' ';
}
cout << endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
208 KB |
Output is correct |
2 |
Correct |
12 ms |
208 KB |
Output is correct |
3 |
Correct |
6 ms |
208 KB |
Output is correct |
4 |
Correct |
3 ms |
208 KB |
Output is correct |
5 |
Correct |
3 ms |
208 KB |
Output is correct |
6 |
Correct |
3 ms |
208 KB |
Output is correct |
7 |
Correct |
8 ms |
208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
208 KB |
Output is correct |
2 |
Correct |
13 ms |
208 KB |
Output is correct |
3 |
Correct |
7 ms |
208 KB |
Output is correct |
4 |
Correct |
6 ms |
208 KB |
Output is correct |
5 |
Correct |
6 ms |
208 KB |
Output is correct |
6 |
Correct |
4 ms |
208 KB |
Output is correct |
7 |
Correct |
10 ms |
332 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
208 KB |
Output is correct |
2 |
Correct |
7 ms |
208 KB |
Output is correct |
3 |
Correct |
9 ms |
208 KB |
Output is correct |
4 |
Correct |
4 ms |
208 KB |
Output is correct |
5 |
Correct |
6 ms |
208 KB |
Output is correct |
6 |
Correct |
7 ms |
208 KB |
Output is correct |
7 |
Correct |
6 ms |
208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
208 KB |
Output is correct |
2 |
Correct |
7 ms |
208 KB |
Output is correct |
3 |
Correct |
5 ms |
208 KB |
Output is correct |
4 |
Correct |
4 ms |
324 KB |
Output is correct |
5 |
Correct |
7 ms |
208 KB |
Output is correct |
6 |
Correct |
8 ms |
212 KB |
Output is correct |
7 |
Correct |
10 ms |
208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
208 KB |
Output is correct |
2 |
Correct |
4 ms |
208 KB |
Output is correct |
3 |
Correct |
7 ms |
208 KB |
Output is correct |
4 |
Correct |
9 ms |
208 KB |
Output is correct |
5 |
Correct |
4 ms |
208 KB |
Output is correct |
6 |
Correct |
3 ms |
208 KB |
Output is correct |
7 |
Correct |
5 ms |
208 KB |
Output is correct |