#include <bits/stdc++.h>
using namespace std;
const int nx=155;
int n, res, cnt, vs[nx], ans[nx];
vector<int> d[nx];
int query(vector<int> v)
{
cout<<v.size()<<' ';
for (auto x:v) cout<<x<<' ';
cout<<endl;
cin>>res;
return res;
}
void dfs(int u, int p)
{
vs[u]=1;
ans[u]=cnt;
for (auto v:d[u]) if (v!=p&&!vs[v]) dfs(v, u);
}
int main()
{
cin.tie(NULL)->sync_with_stdio(false);
cin>>n;
for (int i=1; i<=n; i++) for (int j=i+1; j<=n; j++) if (query(vector<int> {i, j})==2) d[i].push_back(j), d[j].push_back(i);
for (int i=1; i<=n; i++) if (!vs[i]) cnt++, dfs(i, i);
cout<<0<<' ';
for (int i=1; i<=n; i++) cout<<ans[i]<<' ';
cout<<endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
45 ms |
968 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
46 ms |
1236 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
37 ms |
344 KB |
Integer 2 violates the range [1, 1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
45 ms |
1204 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
47 ms |
1484 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |