# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
916726 | Dec0Dedd | Watching (JOI13_watching) | C++14 | 300 ms | 32192 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;
typedef long long ll;
const int N = 2e3+10;
const int INF = 1e9+10;
ll a[N], n, p, q;
ll dp[N][N];
bool check(ll w) {
for (int i=0; i<=n; ++i) {
for (int j=0; j<=n; ++j) dp[i][j]=INF;
}
dp[0][0]=0;
ll ppt=1, qpt=1;
for (int i=1; i<=n; ++i) {
while (a[i]-a[ppt]+1 > w) ++ppt;
while (a[i]-a[qpt]+1 > 2*w) ++qpt;
for (int j=1; j<=p; ++j) dp[i][j]=dp[ppt-1][j-1];
for (int j=0; j<=p; ++j) dp[i][j]=min(dp[i][j], dp[qpt-1][j]+1);
}
for (int i=0; i<=p; ++i) {
if (dp[n][i] <= q) return true;
} return false;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |