# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
164470 | mhy908 | Carnival (CEOI14_carnival) | C++14 | 27 ms | 376 KiB |
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 pb push_back
#define mp make_pair
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
const LL llinf=9000000000000000000;
const int inf=2000000000;
int query(int a, int b){
printf("%d ", b-a+1);
for(int i=a; i<=b; i++)printf("%d ", i);
fflush(stdout);
int ret;
scanf("%d", &ret);
return ret;
}
int n, col[160], r=1;
int sum[160];
int main()
{
scanf("%d", &n);
col[1]=sum[1]=1;
for(int i=2; i<=n; i++){
sum[i]=query(1, i);
if(sum[i-1]+1==sum[i]){
col[i]=++r;
continue;
}
else{
int s=1, e=i-1;
while(s<e){
int mid=(s+e+1)/2;
if(query(mid, i)==query(mid, i-1)+1)e=mid-1;
else s=mid;
}
col[i]=col[s];
}
}
printf("0 ");
for(int i=1; i<=n; i++)printf("%d ", col[i]);
}
Compilation message (stderr)
# | 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... |