# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
35031 | dqhungdl | Watching (JOI13_watching) | C++14 | 519 ms | 17724 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>
using namespace std;
int n,P,Q,a[2005],f[2005][2005];
bool Check(int w)
{
for(int i=0;i<=n;i++)
for(int j=0;j<=P;j++)
f[i][j]=1e9;
f[0][0]=0;
for(int i=1;i<=n;i++)
{
int id1,id2;
for(int j=1;j<=i;j++)
if(a[i]-a[j]+1<=w)
{
id1=j;
break;
}
for(int j=1;j<=i;j++)
if(a[i]-a[j]+1<=2*w)
{
id2=j;
break;
}
for(int j=1;j<=P;j++)
f[i][j]=min(f[i][j],f[id1-1][j-1]);
for(int j=0;j<=P;j++)
f[i][j]=min(f[i][j],f[id2-1][j]+1);
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |