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;
#define ll long long
int n, mx = 1;
int arr[155];
int ans[155];
int ask(int mid, int x) {
cout << mid + 1 << " ";
for(int i = 1; i <= mid; i++) {
cout << i << " ";
}
cout << x << "\n";
cout.flush();
int ret;
cin >> ret;
return ret;
}
int main() {
cin >> n;
arr[1] = 1;
ans[1] = 1;
for(int i = 2; i <= n; i++) {
cout << i << " ";
for(int j = 1; j <= i; j++) {
cout << j;
if (j < i) {
cout << " ";
}
}
cout << '\n';
cout.flush();
cin >> arr[i];
if (arr[i] > mx) {
mx = arr[i];
ans[i] = arr[i];
}
}
/*
for(int i = 1; i <= n; i++) {
cout << ans[i] << "-";
}
cout << endl;
*/
for(int i = 2; i <= n; i++) {
if (ans[i] == 0) {
int l = 1, r = i - 1, ret = 0;
while(l <= r) {
int mid = (l + r) / 2;
if (ask(mid, i) == arr[mid]) {
ret = mid;
r = mid - 1;
}
else {
l = mid + 1;
}
}
ans[i] = arr[ret];
/*
for(int i = 1; i <= n; i++) {
cout << ans[i] << "-";
}
cout << endl;
*/
}
}
cout << 0 << " ";
for(int i = 1; i <= n; i++) {
cout << ans[i] << " ";
}
cout << "\n";
cout.flush();
}
# | 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... |