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 <iostream>
#include <vector>
#include <utility>
#include <sstream>
#include <climits>
#include <cstring>
#define ll long long
#define ld long double
using namespace std;
const ll mod = 1e9 + 7;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
int main()
{
// freopen("input_text", "r", stdin);
// freopen("output_text", "w", stdout);
// ios_base::sync_with_stdio(NULL); cin.tie(0); cout.tie(0);
int n;
cin >> n;
vi color(n, -1);
color[0] = 0;
vi idx({0});
for (int i = 1; i < n; i++)
{
int l = 0, r = idx.size() - 1;
while (l <= r)
{
if (l == r) {
cout << 2 << " " << idx[l] + 1 << " " << i + 1 << endl;
int ans;
cin >> ans;
if (ans == 1) {
color[i] = l;
} else {
color[i] = idx.size();
idx.push_back(i);
}
break;
}
int mid = (l + r) >> 1;
cout << mid - l + 2 << " ";
for (int j = l; j <= mid; j++) {
cout << idx[j] + 1 << " ";
}
cout << i + 1 << endl;
int ans;
cin >> ans;
if (ans == mid - l + 2) {
l = mid + 1;
} else {
r = mid;
}
}
}
cout << "0 ";
for (int i = 0; i < n; i++) {
cout << color[i] + 1 << ' ';
}
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... |