This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
const int mxN = 157;
int ans[mxN];
int32_t main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n;
cin >> n;
int cur = 1;
set<int> zeros;
for (int i = 1; i <= n; ++i) {
zeros.insert(i);
}
for (int i = 1; i <= n; ++i) {
if (!ans[i]) {
ans[i] = cur++;
if (zeros.size() == 1) {
break;
}
cout << zeros.size() << ' ';
for (auto zero : zeros) {
cout << zero << ' ';
}
cout << endl;
int k;
cin >> k;
k = zeros.size() - k;
zeros.erase(i);
for (int j = i + 1; j <= n && k; ++j) {
if (!ans[j]) {
cout << "2 " << i << ' ' << j << endl;
int num;
cin >> num;
if (num == 1) {
ans[j] = ans[i];
zeros.erase(j);
--k;
}
}
}
}
}
cout << "0 ";
for (int i = 1; i <= n; ++i) {
cout << ans[i] << ' ';
}
cout << endl;
}
# | 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... |