#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define F first
#define S second
#define pb push_back
//#define endl '\n'
#define ll long long
#define pi pair<int,int>
using namespace std;
const int MOD = 1e9 + 7;
const int N = 155;
int n;
int ask(vector<int> v) {
cout << v.size() << " ";
for (int i : v) cout << i << " ";
cout << endl;
int x; cin >> x;
return x;
}
vector<int> g[N];
int nxt = 0, used[N], res[N];
void dfs(int v) {
used[v] = 1;
res[v] = nxt;
for (int i : g[v]) if (!used[i]) dfs(i);
}
int main() {
ios_base :: sync_with_stdio(0);
cin.tie(0);
cin >> n;
for (int i = 1; i <= n; i++) {
for (int j = i + 1; j <= n; j++) {
if (ask({i, j}) == 1) g[i].pb(j), g[j].pb(i);
}
}
for (int i = 1; i <= n; i++) {
if (!used[i]) {
nxt++;
dfs(i);
}
}
cout << 0 << " ";
for (int i = 1; i <= n; i++) {
cout << res[i] << " ";
}
cout << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
138 ms |
400 KB |
Partially correct |
2 |
Partially correct |
45 ms |
384 KB |
Partially correct |
3 |
Partially correct |
86 ms |
384 KB |
Partially correct |
4 |
Partially correct |
100 ms |
384 KB |
Partially correct |
5 |
Partially correct |
64 ms |
384 KB |
Partially correct |
6 |
Partially correct |
105 ms |
480 KB |
Partially correct |
7 |
Partially correct |
73 ms |
384 KB |
Partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
60 ms |
504 KB |
Partially correct |
2 |
Partially correct |
155 ms |
388 KB |
Partially correct |
3 |
Partially correct |
97 ms |
384 KB |
Partially correct |
4 |
Partially correct |
128 ms |
384 KB |
Partially correct |
5 |
Partially correct |
149 ms |
384 KB |
Partially correct |
6 |
Partially correct |
89 ms |
504 KB |
Partially correct |
7 |
Partially correct |
119 ms |
384 KB |
Partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
112 ms |
532 KB |
Partially correct |
2 |
Partially correct |
98 ms |
384 KB |
Partially correct |
3 |
Partially correct |
123 ms |
384 KB |
Partially correct |
4 |
Partially correct |
83 ms |
384 KB |
Partially correct |
5 |
Partially correct |
81 ms |
384 KB |
Partially correct |
6 |
Partially correct |
87 ms |
384 KB |
Partially correct |
7 |
Partially correct |
166 ms |
384 KB |
Partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
121 ms |
384 KB |
Partially correct |
2 |
Partially correct |
115 ms |
632 KB |
Partially correct |
3 |
Partially correct |
55 ms |
384 KB |
Partially correct |
4 |
Partially correct |
167 ms |
384 KB |
Partially correct |
5 |
Partially correct |
94 ms |
392 KB |
Partially correct |
6 |
Partially correct |
51 ms |
520 KB |
Partially correct |
7 |
Partially correct |
151 ms |
384 KB |
Partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
56 ms |
536 KB |
Partially correct |
2 |
Partially correct |
85 ms |
392 KB |
Partially correct |
3 |
Partially correct |
83 ms |
384 KB |
Partially correct |
4 |
Partially correct |
53 ms |
384 KB |
Partially correct |
5 |
Partially correct |
156 ms |
400 KB |
Partially correct |
6 |
Partially correct |
95 ms |
384 KB |
Partially correct |
7 |
Partially correct |
55 ms |
384 KB |
Partially correct |