题目链接 Free tour II 题意:有$N$个顶点的树,节点间有权值, 节点分为黑点和白点. 找一条最长路径使得 路径上黑点数量不超过K个 这是树的点分治比较基本的题,涉及树上启发式合并……仰望了黄学长的博客之后稍微有点明白了(还没有很深入地理解) #include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for (int i(a); i <= (b); ++i) #define dec(i, a, b)…
http://www.spoj.com/problems/FTOUR2/ After the success of 2nd anniversary (take a look at problem FTOUR for more details), this 3rd year, Travel Agent SPOJ goes on with another discount tour. The tour will be held on ICPC island, a miraculous one on…
After the success of 2nd anniversary (take a look at problem FTOUR for more details), this 3rd year, Travel Agent SPOJ goes on with another discount tour. The tour will be held on ICPC island, a miraculous one on the Pacific Ocean. We list N places (…
求树上最长路径使得经过的拥挤节点个数不超过K //欢迎访问这个博客!http://www.cnblogs.com/luyouqi233/p/8036828.html #include<cstdio> #include<algorithm> #include<cstring> #include<vector> #define N 200010 using namespace std; typedef long long ll; typedef pair<…
本文版权归ljh2000和博客园共有,欢迎转载,但须保留此声明,并给出原文链接,谢谢合作. 本文作者:ljh2000 作者博客:http://www.cnblogs.com/ljh2000-jump/转载请注明出处,侵权必究,保留最终解释权! Description After the success of 2nd anniversary (take a look at problem FTOUR for more details), this 3rd year, Travel Agent SP…
Longest Common Substring II Time Limit: 2000ms Memory Limit: 262144KB A string is finite sequence of characters over a non-empty finite set Σ. In this problem, Σ is the set of lowercase letters. Substring, also called factor, is a consecutive sequenc…