CF772E Verifying Kingdom】的更多相关文章

CF772E Verifying Kingdom 有趣的交互题(交互题都挺有意思的) %ywy 增量法构造 考虑加入了前i个叶子 那么树是前i个叶子构成的虚树! 最后n个叶子构成的虚树就是答案! 怎样确定第i+1个叶子的位置? 用点分治“二分”! 每次找到当前连通块的重心rt,注意rt不能是叶子 维护rt的两个儿子,父亲,两个儿子内部随意一个叶子has[0],has[1] 用has[0],has[1],i+1进行ask,X,Y,Z唯一确定一个方向:fa.rson,lson 递归进去二分. 边界:…
广告 ZJOI2018Round2游记 All Falls Down 非常感谢学弟学妹们捧场游记虽然这是一篇假游记 ZJOI Round1今天正式落下帷幕.在这过去的三天里遇到了很多朋友,见识了很多有趣的人和事.或许这只是我整个OI生涯中的卷首一场,但是允许我谨此游记献给所有的一切.所有的你们. ZJOIday1游记 8:30:然而报告厅里选手们陆陆续续地并没有到齐-- 第一场主讲人是绍一的任轩笛,讲课pdf的标题一如既往地是「杂题选讲」听主讲人说都是一些套路题 Binary Cards 不上升…
「WC2018」即时战略 考虑对于一条链:直接随便找点,然后不断问即可. 对于一个二叉树,树高logn,直接随便找点,然后不断问即可. 正解: 先随便找到一个点,问出到1的路径 然后找别的点,考虑问出来第一个从1过来的未知位置,就可以一口气问下去了. 怎么找? logn询问次数 法一: 点分治 有点类似:CF772E Verifying Kingdom 可以直接确定走向 暴力插入点,替罪羊重构 O(nlog^2n) 法二: LCT 直接在实链上不断二分,然后跳到下一个实链上 复杂度分析可以类比a…
Constructing Roads In JGShining's Kingdom  HDU1025 题目主要理解要用LCS进行求解! 并且一般的求法会超时!!要用二分!!! 最后蛋疼的是输出格式的注意(直接报错误!!!) #include<iostream> #include<stdio.h> #include<algorithm> #include<string.h> using namespace std; ],dp[]; int main() { ,…
Kingdom Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 142    Accepted Submission(s): 84Special Judge Problem Description Teacher Mai has a kingdom consisting of n cities. He has planned the tr…
Description Meanwhile, the kingdom of K is getting ready for the marriage of the King's daughter. However, in order not to lose face in front of the relatives, the King should first finish reforms in his kingdom. As the King can not wait for his daug…
Rabbit Kingdom Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 40    Accepted Submission(s): 20 Problem Description Long long ago, there was an ancient rabbit kingdom in the forest. Every rabbit…
Constructing Roads In JGShining's Kingdom Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 14635    Accepted Submission(s): 4158 Problem Description JGShining's kingdom consists of 2n(n is no mo…
D. Dividing Kingdom II   Long time ago, there was a great kingdom and it was being ruled by The Great Arya and Pari The Great. These two had some problems about the numbers they like, so they decided to divide the great kingdom between themselves. Th…
Constructing Roads In JGShining's Kingdom Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 23467    Accepted Submission(s): 6710 Problem Description JGShining's kingdom consists of 2n(n is no mo…