# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
161703 | jovan_b | Watching (JOI13_watching) | C++17 | 264 ms | 16220 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;
typedef long double ld;
int n, p, q;
int event[2005];
int dp[2005][2005];
bool check(int w){
int small = 0, large = 0;
for(int i=1; i<=n; i++){
while(event[i]-event[small+1] >= w) small++;
while(event[i]-event[large+1] >= 2*w) large++;
for(int j=0; j<=p; j++){
dp[i][j] = n+5;
if(j) dp[i][j] = min(dp[i][j], dp[small][j-1]);
dp[i][j] = min(dp[i][j], dp[large][j] + 1);
}
}
//if(w == 3) cout << dp[n][p] << " " << q << endl;
return dp[n][p] <= q;
}
int main(){
ios_base::sync_with_stdio(false), cin.tie(0);
cout.precision(10);
cout << fixed;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |