Acesrc and Travel 时间限制: 1 Sec 内存限制: 128 MB 题目描述 Acesrc is a famous tourist at Nanjing University second to none. During this summer holiday, he, along with Zhang and Liu, is going to travel to Hong Kong. There are n spots in Hong Kong, and n−1 bidir…
Problem Description Acesrc is a famous tourist at Nanjing University second to none. During this summer holiday, he, along with Zhang and Liu, is going to travel to Hong Kong. There are n spots in Hong Kong, and n−1 bidirectional sightseeing bus rout…
#include<bits/stdc++.h> typedef long long ll; using namespace std; const int maxn=1e6+50; const ll mod=1e9+7; int a[maxn],b[maxn]; vector<int>G[maxn]; ll dp[maxn][2]; /// 0 zhang 1 liu ll hello[maxn][2]; ll hello2[maxn][2]; int who1[maxn][2];…
http://acm.hdu.edu.cn/showproblem.php?pid=6662 仿照 CC B - TREE 那道题的思路写的,差不多.也是要走路径. 像这两种必须走到叶子的路径感觉是必须从INF出发,使得它强制从子树转移过来.否则假如可以在中间节点中断的话,初始值就是0,转移的时候假如子树更不好就不会更新这个0. 与哪个求每个点去往的最远点的标号(同样远的求最小标号)类似. f[u]表示从u节点向下走向子树的最优值,这样必须dfs到叶子然后初始化叶子再返回. g[u]表示从u节点…
Solved Pro.ID Title Ratio(Accepted / Submitted) 1001 Acesrc and Cube Hypernet 7.32%(3/41) 1002 Acesrc and Girlfriend 4.35%(2/46) 1003 Acesrc and Good Numbers 暴力打表 24.80%(213/859) 1004 Acesrc and Hunting 21.74%(90/414) 1005 Acesrc and String…