# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
111318 | vex | Xylophone (JOI18_xylophone) | C++14 | 0 ms | 0 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>
#include<xylophone.h>
using namespace std;
int a[5005];
bool bio[5005];
int solve(int n)
{
int l=1;
int r=n;
int sol=n;
while(l<=r)
{
int mid=(l+r)/2;
if(query(1,mid)==n-1)
{
sol=mid;
r=mid-1;
}
else l=mid+1;
}
for(int i=1;i<=n;i++)bio[i]=false;
bio[n]=true;
a[sol]=n;bio[n]=true;
if(sol<n)a[sol+1]=n-query(sol,sol+1);
a[sol-1]=n-query(sol-1,sol);