#include <bits/stdc++.h>
using namespace std;
const int nx=155;
int n, ans[nx], res, cnt;
int query(vector<int> v)
{
cout<<v.size()<<' ';
for (auto x:v) cout<<x<<' ';
cout<<endl;
cin>>res;
return res;
}
int in(int idx, int l, int r)
{
if (r<l) return 0;
vector<int> qrs;
for (int i=l; i<=r; i++) qrs.push_back(i);
auto sv=query(qrs);
qrs.push_back(idx);
return sv==query(qrs);
}
int search(int idx, int l, int r)
{
if (l==r) return l;
int md=(l+r)/2;
if (in(idx, l, md)) return search(idx, l, md);
else return search(idx, md+1, r);
}
int main()
{
cin.tie(NULL)->sync_with_stdio(false);
cin>>n;
for (int i=1; i<=n; i++)
{
if (!in(i, i+1, n)) ans[i]=++cnt;
else
{
int vl=search(i, i+1, n);
if (!ans[i]) ans[i]=ans[vl]=++cnt;
else ans[vl]=ans[i];
}
}
cout<<0<<' ';
for (int i=1; i<=n; i++) cout<<ans[i];
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
10 ms |
712 KB |
Expected integer, but "123456786910167148101156328328...2181011131439215161718192082122" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
10 ms |
716 KB |
Expected integer, but "122345333312152255324142532313...3324425212154212223226144278910" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
9 ms |
708 KB |
Expected integer, but "111111111111111111111111111111...1111111111111111111111111111112" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
11 ms |
708 KB |
Expected integer, but "121344434422342224141244113212...3342431434134234232442513621278" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
10 ms |
712 KB |
Expected integer, but "122211212112112122122221212212...1112122221222112211111111222234" found |
2 |
Halted |
0 ms |
0 KB |
- |