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>
#define ll long long
#define ull unsigned ll
#define f first
#define s second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define epb emplace_back
using namespace std;
int GetDif(int l, int r){
cout << r - l + 1 << " ";
for(int i= l; i <= r; i++){
cout << i << ' ';
}
cout << "\n";
cout.flush();
int x; cin >> x;
return x;
}
int main(){
int n; cin >> n;
int c[n + 1];
fill(c + 1, c + n + 1, 0);
int cur = 1;
for(int i= 1;i <= n; i++){
if(c[i] == 0)c[i] = cur++;
int l = i , r = n + 1;
while(l + 1< r){
int mid = (l + r) / 2;
int v = GetDif(i, mid);
int u = GetDif(i + 1, mid);
if(u == v) r = mid;
else l = mid;
}
if(r != n + 1) c[r] = c[i];
}
cout << 0 << ' ';
for(int i = 1; i <= n; i++){
cout << c[i] << ' ';
}
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... |