# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
384982 | dolphingarlic | Torrent (COI16_torrent) | C++14 | 150 ms | 33896 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>
typedef long long ll;
using namespace std;
int n, a, b, dp[300001];
vector<int> graph[300001], chain, chain_cdp[300001];
bool on_chain[300001], good[300001];
bool find_chain(int node = a, int parent = 0) {
if (node == b) {
chain.push_back(node);
on_chain[node] = true;
return true;
}
for (int i : graph[node]) if (i != parent && find_chain(i, node)) {
chain.push_back(node);
on_chain[node] = true;
return true;
}
return false;
}
void calc_dp(int node, int parent = 0) {
vector<int> cdp;
for (int i : graph[node]) if (i != parent && !on_chain[i]) {
calc_dp(i, node);
cdp.push_back(dp[i]);
}
sort(cdp.begin(), cdp.end(), greater<int>());
for (int i = 0; i < cdp.size(); i++) {
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |