#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})==1) 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 |
Partially correct |
34 ms |
460 KB |
Partially correct |
2 |
Partially correct |
39 ms |
456 KB |
Partially correct |
3 |
Partially correct |
47 ms |
432 KB |
Partially correct |
4 |
Partially correct |
37 ms |
344 KB |
Partially correct |
5 |
Partially correct |
34 ms |
712 KB |
Partially correct |
6 |
Partially correct |
37 ms |
1540 KB |
Partially correct |
7 |
Partially correct |
32 ms |
456 KB |
Partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
47 ms |
852 KB |
Partially correct |
2 |
Partially correct |
48 ms |
456 KB |
Partially correct |
3 |
Partially correct |
24 ms |
344 KB |
Partially correct |
4 |
Partially correct |
43 ms |
344 KB |
Partially correct |
5 |
Partially correct |
47 ms |
1524 KB |
Partially correct |
6 |
Partially correct |
52 ms |
1296 KB |
Partially correct |
7 |
Partially correct |
43 ms |
960 KB |
Partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
36 ms |
1548 KB |
Partially correct |
2 |
Partially correct |
42 ms |
956 KB |
Partially correct |
3 |
Partially correct |
41 ms |
448 KB |
Partially correct |
4 |
Partially correct |
39 ms |
340 KB |
Partially correct |
5 |
Partially correct |
43 ms |
728 KB |
Partially correct |
6 |
Partially correct |
47 ms |
1260 KB |
Partially correct |
7 |
Partially correct |
40 ms |
460 KB |
Partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
35 ms |
1208 KB |
Partially correct |
2 |
Partially correct |
46 ms |
712 KB |
Partially correct |
3 |
Partially correct |
45 ms |
344 KB |
Partially correct |
4 |
Partially correct |
46 ms |
344 KB |
Partially correct |
5 |
Partially correct |
47 ms |
1220 KB |
Partially correct |
6 |
Partially correct |
38 ms |
1492 KB |
Partially correct |
7 |
Partially correct |
45 ms |
452 KB |
Partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
51 ms |
984 KB |
Partially correct |
2 |
Partially correct |
46 ms |
700 KB |
Partially correct |
3 |
Partially correct |
46 ms |
444 KB |
Partially correct |
4 |
Partially correct |
40 ms |
452 KB |
Partially correct |
5 |
Partially correct |
50 ms |
464 KB |
Partially correct |
6 |
Partially correct |
49 ms |
692 KB |
Partially correct |
7 |
Partially correct |
52 ms |
596 KB |
Partially correct |