# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1172873 | Tsagana | Watching (JOI13_watching) | C++20 | 1 ms | 324 KiB |
#include<bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(false);cin.tie();cout.tie();
#define all(x) x.begin(), x.end()
#define int long long
#define pq priority_queue
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define pp pop_back
#define F first
#define S second
using namespace std;
int n, p, q;
int a[2010];
int dp[2010][2010];
int check(int x) {
for (int i = 1; i <= q; i++) dp[i][0] = 1e9;
dp[0][0] = 0;
int t1 = 1, t2 = 1;
for (int t3 = 1; t3 <= n; t3++) {
while (t1 <= t3 && a[t3] - a[t1] >= 2*x) t1++;
while (t2 <= t3 && a[t3] - a[t2] >= x ) t2++;
for (int i = 0; i <= q; i++) {
dp[i][t3] = 1e9;
if (i > 0) dp[i][t3] = min(dp[i-1][t1-1], dp[i][t3]);
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |