# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
722385 | hyakup | Watching (JOI13_watching) | C++17 | 124 ms | 16056 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;
const int maxn = 2010;
int pos[maxn];
int dp[maxn][maxn];
int n, p, q;
bool check( int x ){
for( int j = 0; j < maxn; j++ ) dp[0][j] = 0;
int k1 = 0, k2 = 0;
for( int i = 1; i <= n; i++ ){
while( pos[k1 + 1] < pos[i] - x + 1 ) k1++;
while( pos[k2 + 1] < pos[i] - 2*x + 1 ) k2++;
dp[i][0] = dp[k2][0] + 1;
for( int j = 1; j <= p; j++ ){
dp[i][j] = min( dp[k1][j - 1], dp[k2][j] + 1 );
}
}
if( dp[n][p] <= q ) return true;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |