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;
int r;
int p(int a, int b) {
cout<<b-a+1<<' ';
for(int i = a;i<=b;i++)cout<<i<<' ';
cout<<"\n";
fflush(stdout);
cin >> r;
return r;
}
int main () {
int n;
cin >> n;
int A[160] = {0};
int m = 0;
for(int i = 1;i<=n;i++) {
if(i == 1) {
A[i] = ++m;
}
else if(p(1, i) == p(1, i-1)+1) {
A[i] = ++m;
}
else {
int ans = 0;
for(int j = 1;j<=i-1;j++) {
if(p(j, i) == p(j, i-1) + 1)continue;
else ans = j;
}
A[i] = A[ans];
}
}
A[0] = 0;
for(int i = 0;i<=n;i++) {
cout<<A[i]<<' ';
}
cout<<'\n';
fflush(stdout);
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... |