#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 in_same(int x, int y) {
for (int i = 1; i <= n; i++) used[i] = 0;
dfs(x);
return used[y];
}
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 (in_same(i, j)) continue;
if (ask({i, j}) == 1) g[i].pb(j), g[j].pb(i);
}
}
memset(used, 0, sizeof(used));
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 |
67 ms |
384 KB |
Partially correct |
2 |
Partially correct |
70 ms |
384 KB |
Partially correct |
3 |
Partially correct |
73 ms |
384 KB |
Partially correct |
4 |
Partially correct |
87 ms |
384 KB |
Partially correct |
5 |
Partially correct |
57 ms |
416 KB |
Partially correct |
6 |
Correct |
11 ms |
384 KB |
Output is correct |
7 |
Partially correct |
94 ms |
360 KB |
Partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
82 ms |
384 KB |
Partially correct |
2 |
Partially correct |
88 ms |
388 KB |
Partially correct |
3 |
Partially correct |
61 ms |
392 KB |
Partially correct |
4 |
Partially correct |
89 ms |
384 KB |
Partially correct |
5 |
Partially correct |
61 ms |
384 KB |
Partially correct |
6 |
Correct |
24 ms |
384 KB |
Output is correct |
7 |
Partially correct |
90 ms |
392 KB |
Partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
308 KB |
Output is correct |
2 |
Partially correct |
105 ms |
388 KB |
Partially correct |
3 |
Partially correct |
95 ms |
388 KB |
Partially correct |
4 |
Partially correct |
110 ms |
360 KB |
Partially correct |
5 |
Partially correct |
69 ms |
384 KB |
Partially correct |
6 |
Partially correct |
52 ms |
384 KB |
Partially correct |
7 |
Partially correct |
105 ms |
384 KB |
Partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
123 ms |
396 KB |
Partially correct |
2 |
Partially correct |
64 ms |
396 KB |
Partially correct |
3 |
Partially correct |
117 ms |
384 KB |
Partially correct |
4 |
Partially correct |
82 ms |
384 KB |
Partially correct |
5 |
Partially correct |
75 ms |
384 KB |
Partially correct |
6 |
Partially correct |
118 ms |
384 KB |
Partially correct |
7 |
Partially correct |
115 ms |
400 KB |
Partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
55 ms |
392 KB |
Partially correct |
2 |
Partially correct |
65 ms |
392 KB |
Partially correct |
3 |
Partially correct |
159 ms |
384 KB |
Partially correct |
4 |
Partially correct |
149 ms |
392 KB |
Partially correct |
5 |
Partially correct |
127 ms |
384 KB |
Partially correct |
6 |
Partially correct |
86 ms |
384 KB |
Partially correct |
7 |
Partially correct |
133 ms |
384 KB |
Partially correct |