# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
505754 | neonaht | Torrent (COI16_torrent) | C++14 | 338 ms | 28388 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>
#define st first
#define nd second
#define ll int64_t
using namespace std;
const int SZ=3e5+7;
vector <int> node[SZ];
int dp[SZ],GetA[SZ],GetB[SZ],a,b,go(0);
void dfs(int v,int p,int z) {
if(node[v].size()==1 && v!=a && v!=b) return ;
vector <int> went;
for(auto x:node[v]) {
if(x==p || x==z) continue;
dfs(x,v,z);
went.emplace_back(dp[x]);
}
int mx(0);
sort(went.begin(),went.end(),greater<int>());
for(int i=0;i<went.size();i++) mx=max(mx,went[i]+i+1);
dp[v]=mx;
return ;
}
int main(void) {
cin.tie(0)->ios::sync_with_stdio(false);
int n,res((int)1e9);
cin >> n >> a >> b;
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |