# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
30872 | Navick | Watching (JOI13_watching) | C++14 | 263 ms | 17968 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 F first
#define S second
#define pii pair<int, int>
#define pb push_back
using namespace std;
typedef long long ll;
typedef long double ld;
const int N = 2010, INF = 1e9 + 10;
int dp[N][N], n, p, q;
int a[N];
bool check(int w){
for(int j=0; j<=p; j++)
dp[0][j] = 0;
int ptr = -1, ptr2 = -1;
for(int i=1; i<=n; i++){
while(a[i - 1] - a[ptr + 1] >= w)ptr++;
while(a[i - 1] - a[ptr2 + 1] >= 2*w)ptr2++;
for(int j=0; j<=p; j++){
dp[i][j] = INF;
if(j > 0)
dp[i][j] = dp[ptr + 1][j - 1];
if(q > 0){
dp[i][j] = min(dp[i][j], dp[ptr2 + 1][j] + 1);
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |