# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
401644 | BERNARB01 | Fireworks (APIO16_fireworks) | C++17 | 103 ms | 12260 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 int N = 5001;
const long long inf = (long long) 4e18L;
int n, m;
vector<pair<int, long long>> g[N];
long long dp[N][302];
long long sol(int u, int left) {
if (g[u].size() == 0) {
assert(left == 0);
return 0;
}
long long& ret = dp[u][left];
if (ret != -1) {
return ret;
}
ret = 0;
for (pair<int, long long> _p : g[u]) {
long long sub = inf;
int v = _p.first;
long long w = _p.second;
if (g[v].size() == 0) {
sub = abs(w - left);
ret += sub;
continue;
}
# | 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... |