# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
340678 | ijxjdjd | Collecting Stamps 3 (JOI20_ho_t3) | C++14 | 375 ms | 144364 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;
using ll = long long;
const int MAXN = 205;
const ll INF = (ll)(1e18);
ll dp[MAXN][MAXN][MAXN][2];
bool vis[MAXN][MAXN][MAXN][2];
ll pref[MAXN];
ll suff[MAXN];
ll arr[MAXN];
ll T[MAXN];
int N;
ll calc(int pre, int suf, int tot, int k) {
if (tot < 0 || pre < 0 || suf > N+2) {
return INF;
}
if (vis[pre][suf][tot][k]){
return dp[pre][suf][tot][k];
}
vis[pre][suf][tot][k] = true;
if (k == 0 && pre != 0) {
ll curSide = calc(pre-1, suf, tot-1, k);
ll otherSide = calc(pre-1, suf, tot-1, k^1);
ll none = min(calc(pre-1, suf, tot, k) + arr[pre], calc(pre-1, suf, tot, k^1) + suff[suf] + pref[pre]);
if (curSide + arr[pre] <= T[pre]) {
none = min(none, curSide + arr[pre]);
}
if (otherSide + suff[suf] + pref[pre] <= T[pre]) {
# | 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... |