To your surprise, Jamie is the final boss! Ehehehe. Jamie has given you a tree with n vertices, numbered from 1 to n. Initially, the root of the tree is the vertex with number 1. Also, each vertex has a value on it. Jamie also gives you three types o…
传送门:http://codeforces.com/contest/1092/problem/F F. Tree with Maximum Cost time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given a tree consisting exactly of nn vertices. Tree is a…
E. Jamie and Tree time limit per test 2.5 seconds memory limit per test 256 megabytes input standard input output standard output To your surprise, Jamie is the final boss! Ehehehe. Jamie has given you a tree with n vertices, numbered from 1 to n. In…
http://codeforces.com/contest/1187/problem/E 分析:问得分最高,实际上就是问以哪个节点出发得到的分数最多,而呈现成代码形式就变成了换根,max其得分!!!而要利用之前算过的得分来求. #include<bits/stdc++.h> using namespace std; typedef long long ll; ; vector<int>e[M]; int son[M]; ll ans; int n; void dfs(int u,i…