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>
using namespace std;
#define pb push_back
int ask(vector<int> v){
cout << v.size() << " ";
for (auto x : v) cout << x << " ";
cout << endl;
int res; cin >> res;
return res;
}
void answer(vector<int> ans){
int n = ans.size() - 1;
cout << "0 ";
for (int i = 1; i <= n; ++i){
cout << ans[i] << " ";
}
cout << "\n";
}
int main() {
int n; cin >> n;
vector<int> ans(n+1);
ans[1] = 1;
int k = 2;
for (int i = 2; i <= n; ++i){
vector<int> v;
v.pb(i);
for (int j = 1; j < i; ++j) {
v.pb(j);
int x = ask(v);
if (x == 1){
ans[i] = ans[j];
break;
}
v.pop_back();
}
if (ans[i] == 0) ans[i] = k++;
}
answer(ans);
return 0;
}
# | 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... |