//
// main.cpp
// WinterCamp 2026
//
// Created by Ali AlSalman on 10/01/2026.
//
#include <bits/stdc++.h>
#define INTERACTIVE
//#define TESTCASES
#ifndef INTERACTIVE
#define endl '\n'
#endif
template<typename T>
using vec = std::vector<T>;
using namespace std;
struct G {
int n;
vec<vec<int>> adj;
vec<int> comp;
G(int n) : n(n), adj(n), comp(n, -1) {}
void add(int a, int b) {
adj[a].push_back(b);
adj[b].push_back(a);
}
void dfs(int a, int C) {
comp[a] = C;
for (auto c : adj[a]) if (comp[c] == -1) dfs(c, C);
}
vec<int>& components() {
int C = 0;
for (int i = 0; i < n; i++) if (comp[i] == -1)
dfs(i, C++);
return comp;
}
};
int q(vec<int> friends) {
cout<<friends.size();
for (auto f : friends) cout<<" "<<f + 1; cout<<endl;
int r; cin>>r;
return r;
}
void ans(vec<int> &comp) {
cout<<0;
for (auto c : comp) cout<<" "<<c + 1; cout<<endl;
exit(0);
}
void solve() {
int n;
cin>>n;
G g(n);
for (int i = 0; i < n; i++) for (int j = i + 1; j < n; j++)
if (q({i, j}) == 1)
g.add(i, j);
ans(g.components());
}
int main() {
#ifndef INTERACTIVE
ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#endif
int t = 1;
#ifdef TESTCASES
cin>>t;
#endif
while (t--) solve();
}
| # | 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... |