# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
750586 | Sami_Massah | Collecting Stamps 3 (JOI20_ho_t3) | C++17 | 16 ms | 37624 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int maxn = 200 + 12, inf = 1e9 + 12;
int n, L, dist[maxn], t[maxn], dp[maxn][maxn][maxn];
int 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]));
int 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... |