[POI2011]Inspekcja】的更多相关文章

[POI2011]Inspekcja 题目大意: 给你一棵\(n(n\le10^6)\)个点的树,\(s\)为起点.每次选择一个点作为目标点\(t_i\),沿最短路走到\(t_i\)再走回\(s\)(最后一次除外).相邻两次行动不能经过相同的边.问将每一个点作为\(s\),是否存在一种方案使得除\(s\)外的所有结点都作为目标点被恰好访问一次,如果是,求最小路径和. 思路: 存在合法方案当且仅当去掉\(s\)后剩下的连通块中,最大的连通块大小不超过其余连通块大小之和. 这样的点一定是重心(反过来…
补一发题解.. 整体二分这个东西,一开始感觉复杂度不是很靠谱的样子 问了po姐姐,说套主定理硬干.. #include<bits/stdc++.h> #define ll long long #define inf 1e9 #define N 300005 using namespace std; inline int read(){ ,f=;char ch=getchar(); ;ch=getchar();} *x+ch-';ch=getchar();} return x*f; } int…
2276: [Poi2011]Temperature Time Limit: 20 Sec  Memory Limit: 32 MBSubmit: 293  Solved: 117[Submit][Status] Description The Byteotian Institute of Meteorology (BIM) measures the air temperature daily. The measurement is done automatically, and its res…
2213: [Poi2011]Difference Time Limit: 10 Sec  Memory Limit: 32 MBSubmit: 343  Solved: 108[Submit][Status] Description A word consisting of lower-case letters of the English alphabet ('a'-'z') is given. We would like to choose a non-empty contiguous (…
2212: [Poi2011]Tree Rotations Time Limit: 20 Sec  Memory Limit: 259 MBSubmit: 391  Solved: 127[Submit][Status] Description Byteasar the gardener is growing a rare tree called Rotatus Informatikus. It has some interesting features: The tree consists o…
线段树的合并..对于一个点x, 我们只需考虑是否需要交换左右儿子, 递归处理左右儿子. #include<bits/stdc++.h> using namespace std; #define M(l, r) (((l) + (r)) >> 1) typedef long long ll; ; ; struct Node *null, *pt; struct Node { Node *l, *r; int cnt; Node() : cnt() { l = r = null; }…
2217: [Poi2011]Lollipop Time Limit: 15 Sec  Memory Limit: 64 MBSec  Special JudgeSubmit: 383  Solved: 159[Submit][Status][Discuss] Description 有一个长度为n的序列a1,a2,...,an.其中ai要么是1("W"),要么是2("T"). 现在有m个询问,每个询问是询问有没有一个连续的子序列,满足其和为q. Input 第一行…
BZOJ_2529_[Poi2011]Sticks_贪心 Description Little Johnny was given a birthday present by his grandparents. This present is a box of sticks of various lengths and colours. Johnny wonders if there are three sticks in the set he has been given that would…
BZOJ_2212_[Poi2011]Tree Rotations_线段树合并 Description Byteasar the gardener is growing a rare tree called Rotatus Informatikus. It has some interesting features: The tree consists of straight branches, bifurcations and leaves. The trunk stemming from t…
BZOJ_2527_[Poi2011]Meteors_整体二分 Description Byteotian Interstellar Union (BIU) has recently discovered a new planet in a nearby galaxy. The planet is unsuitable for colonisation due to strange meteor showers, which on the other hand make it an except…