# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1137 | kriii | Watching (JOI13_watching) | C++98 | 248 ms | 17032 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 <stdio.h>
#include <algorithm>
using namespace std;
int N,P,Q,A[2020];
int D[2020][2020];
bool chk(int w)
{
if (w <= 0) return false;
int i,j=1,k=1,l;
for (i=1;i<=N;i++){
while (A[i] - A[j] >= w) j++;
while (A[i] - A[k] >= w * 2) k++;
for (l=0;l<=Q;l++) D[i][l] = D[j-1][l] + 1;
for (l=0;l<=Q;l++){
if (D[i][l+1] > D[k-1][l])
D[i][l+1] = D[k-1][l];
}
}
for (l=0;l<=Q;l++) if (D[N][l] <= P) return true;
return false;
}
int main()
{
int i;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |