# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
947486 | devkudawla | Journey (NOI18_journey) | C++17 | 159 ms | 262144 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;
#define int long long int
int n, m, h;
const int N = 10010, M = 410;
int dp[N + 1][M + 1];
vector<vector<pair<int, int>>> graph(N + 1);
int func(int i, int j) {
if (i < 0 or j < 0) {
return 0;
}
if (dp[i][j] != -1) {
return dp[i][j];
}
int answer = 0;
for (auto [child, weight] : graph[i]) {
for (int wt = j - weight; wt >= 0; wt--) {
answer += func(child, wt);
}
}
return dp[i][j] = answer;
}
void solve(bool testCases = true) {
int T = 1;
if (testCases) cin >> T;
while (T--) {
cin >> n >> m >> h;
memset(dp, -1, sizeof(dp));
for (int i = 0; i < m; i++) {
dp[0][0] = 0;
# | 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... |