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 int long long
#define mod 1000000007
using namespace std;
vector<int>adj[200001];
int vs[151]; int c;
void dfs(int x){
vs[x] = c;
for(auto s:adj[x]){
if(!vs[s]){
vs[s] = c;
dfs(s);
}
}
}
signed main(){
int n; cin >> n;
for(int i = 0; i < n; i++){
int l = i + 1, r = n, aa = -1;
while(l <= r){
int mid = (l + r) / 2;
cout << mid - i << ' ' ;
for(int j = i; j < mid; j++){
cout << j + 1 << ' ';
}
cout << endl;
int ans; cin >> ans;
if(ans == mid - l + 1){
l = mid + 1;
aa = mid + 1;
}else{
r = mid - 1;
}
}
if(aa != -1){
adj[i].push_back(aa);
}
}
for(int i = 0; i < n; i++){
if(!vs[i]){
c++;
dfs(i);
}
}
cout << 0 << ' ' ;
for(int i = 0; i < n;i++){
cout << vs[i] << ' ';
}
cout << endl;
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... |