Countries 描述 There are two antagonistic countries, country A and country B. They are in a war, and keep launching missiles towards each other. It is known that country A will launch N missiles. The i-th missile will be launched at time Tai. It flie…
题目链接 http://acm.split.hdu.edu.cn/showproblem.php?pid=5877 Problem Description You are given a rooted tree of N nodes, labeled from 1 to N. To the ith node a non-negative value ai is assigned.An ordered pair of nodes (u,v) is said to be weak if (1) u…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6203 题意:n+1 个点 n 条边的树(点标号 0 ~ n),有若干个点无法通行,导致 p 组 U V 无法连通.问无法通行的点最少有多少个. 解法:按照询问的LCA深度排序,然后顺序标记每个询问的LCA.根据所给的树(任意点为根)预处理出每个点的前序 DFS 序和后序 DFS 序(需统一标号),及点的深度.根据 p 组 U V 处理每组两点的 LCA .压入优先队列(LCA 深度大的点优先出队).…
2016 10 28 考试 时间 7:50 AM to 11:15 AM 下载链接: 试题 考试包 这次考试对自己的表现非常不满意!! T1看出来是dp题目,但是在考试过程中并没有推出转移方程,考虑了打表,但是发现暴力程序的速度不够,直接交了暴力,没想到暴力程序爆0,考试后仔细查找发现是在深搜过程中的一个剪枝处忘记调整全局变量的值,,,低级错误要引以为戒!! for (int i = 0; i <= cur; i++) { a[x] += i; if (a[x] < a[x-1]) { a[x…
Bobo has a balanced parenthesis sequence P=p 1 p 2…p n of length n and q questions. The i-th question is whether P remains balanced after p ai and p bi swapped. Note that questions are individual so that they have no affect on others. Parenthesis se…
Given a rooted tree ( the root is node 1 ) of N nodes. Initially, each node has zero point. Then, you need to handle Q operations. There're two types: 1 L X: Increase points by X of all nodes whose depth equals L ( the depth of the root is zero ). (x…
任意门:https://nanti.jisuanke.com/t/31459 There's a beach in the first quadrant. And from time to time, there are sea waves. A wave ( xx , yy ) means the wave is a rectangle whose vertexes are ( 00 , 00 ), ( xx , 00 ), ( 00 , yy ), ( xx , yy ). Every ti…