Submission #1004895

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
10048952024-06-21 22:23:33cpdreamerRace (IOI11_race)C++14
0 / 100
2 ms13144 KiB
#include "race.h"
#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
vector<pair<int, int>> adj[300005];
int dp[300005][105];
void dfs(int node, int parent, int K) {
dp[node][0] = 0; // Distance to self with 0 jumps is 0
for (auto &edge : adj[node]) {
int next = edge.first;
int length = edge.second;
if (next == parent) continue;
dfs(next, node, K);
for (int j = K; j >= 0; --j) {
if (dp[node][j] == INF) continue;
for (int l = 1; l + j <= K; ++l) {
if (dp[next][l] != INF) {
dp[node][j + l] = min(dp[node][j + l], dp[node][j] + dp[next][l] + length);
}
}
}
}
}
int best_path(int N, int K, int H[][2], int L[]) {
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...