# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
12949 | gs13068 | Watching (JOI13_watching) | C++98 | 328 ms | 16776 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<cstdio>
#include<algorithm>
long long c[2002];
int x[2002];
int y[2002];
int d[2002][2002];
int main()
{
int l,r,mid;
int i,j,n,a,b;
scanf("%d%d%d",&n,&a,&b);
for(i=1;i<=n;i++)scanf("%lld",&c[i]);
std::sort(c+1,c+n+1);
l=1;
r=1e9;
while(l<r)
{
mid=(l+r)/2;
for(i=1;i<=n;i++)
{
x[i]=std::lower_bound(c+i+1,c+n+1,c[i]+mid)-c;
y[i]=std::lower_bound(c+i+1,c+n+1,c[i]+mid+mid)-c;
}
x[n+1]=y[n+1]=n+1;
for(i=0;i<=n&&i<=a;i++)for(j=0;i+j<=n&&j<=b;j++)d[i][j]=1;
for(i=0;i<n&&i<=a;i++)for(j=0;i+j<n&&j<=b;j++)
{
d[i+1][j]=std::max(d[i+1][j],x[d[i][j]]);
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |