# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
750587 | Sami_Massah | Collecting Stamps 3 (JOI20_ho_t3) | C++17 | 35 ms | 74904 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 long long maxn = 200 + 12, inf = 1e9 + 12;
long long n, L, dist[maxn], t[maxn], dp[maxn][maxn][maxn];
long long find_ans(int a, int b, int c, int k = 0){
if(c < 0)
return inf;
if(dp[a][b][c] != -1){
if(a != 0 && b != 0)
return dp[a][b][c] ;
if(a == 0 && b == 0)
return dp[a][b][c];
if(a == 0)
return dp[a][b][c] + k * (dist[b]);
return dp[a][b][c] + k * (L - dist[a]);
}
// cout << a << ' ' << b << ' ' << c << endl;
dp[a][b][c] = inf;
if(a == 0 && b == 0)
return dp[a][b][c];
if(a == 0){
dp[a][b][c] = min(dp[a][b][c], find_ans(a, b - 1, c) + abs(dist[b] - dist[b - 1]));
long long x = find_ans(a, b - 1, c - 1) + abs(dist[b] - dist[b - 1]);
if(x <= t[b])
dp[a][b][c] = min(dp[a][b][c], x);
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |