Hawk-and-Chicken Time Limit: 6000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2409    Accepted Submission(s): 712 Problem Description Kids in kindergarten enjoy playing a game called Hawk-and-Chicken. But t…
http://acm.hdu.edu.cn/showproblem.php?pid=3639 题意: 有一群孩子正在玩老鹰抓小鸡,由于想当老鹰的人不少,孩子们通过投票的方式产生,但是投票有这么一条规则:投票具有传递性,A支持B,B支持C,那么C获得2票(A.B共两票),输出最多能获得的票数是多少张和获得最多票数的人是谁? 思路: 先强连通缩点反向建图,在计算强连通的时候,需要保存每个连通分支的结点个数. 为什么要反向建图呢?因为要寻找票数最多的,那么肯定是入度为0的点,然后dfs计算它的子节点的…
The King's Problem Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 2137    Accepted Submission(s): 763 Problem Description In the Kingdom of Silence, the king has a new problem. There are N cit…
题意 给定一个长度为 \(n\) 的排列,有 \(q\) 次询问,每次询问一个区间 \([l,r]\) ,找到最小的包含 \([l,r]\) 的区间,满足这个区间包含了一段连续的数字. \(n\leq 10^5\) 分析 考虑相邻的两个位置 \(i,i+1\),记两个位置的值为 $ x ,y(x< y)$ 如果要出现在答案里,要满足 \(val \in[x,y]\) 都出现. 用权值线段树维护一段权值区间出现位置的最左最右端 \([l,r]\),显然位置 \(p \in[l,r]\) 都要在区间…
2707: [SDOI2012]走迷宫 题意:求s走到t期望步数,\(n \le 10^4\),保证\(|SCC| \le 100\) 求scc缩点,每个scc高斯消元,scc之间直接DP 注意每次清空系数矩阵 #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> using namespace std; typ…
/* 给定n个数据中心,m份资料,每份资料在其中的两个中心备份,一天可供下载的时间是h小时 中心i在第hi小时需要维护,无法下载 现在要将一些中心的维护时间往后推1小时,使得任意时刻每份资料都可以被下载,请问最少选择多少个数据中心, 某个中心维护时,在其中资料无法下载,必须到其他点下载, 如果该点对应的点也在维护,那么这个对应点的维护必须往后推 对应点往后推时继续和其余点矛盾,那么其余点也要往后 所以,如果同一份数据的两个点相隔一小时,那么这两个点要么不推迟,要推迟就要一起推迟, 建立模型:点x…
Father Christmas flymouse Time Limit: 1000MS   Memory Limit: 131072K Total Submissions: 3007   Accepted: 1021 Description After retirement as contestant from WHU ACM Team, flymouse volunteered to do the odds and ends such as cleaning out the computer…
一个有向图G=(V,E)称为半连通的(Semi-Connected),如果满足:?u,v∈V,满足u→v或v→u,即对于图中任意两点u,v,存在一条u到v的有向路径或者从v到u的有向路径.若G'=(V',E')满足V'?V,E'是E中所有跟V'有关的边,则称G'是G的一个导出子图.若G'是G的导出子图,且G'半连通,则称G'为G的半连通子图.若G'是G所有半连通子图中包含节点数最多的,则称G'是G的最大半连通子图.给定一个有向图G,请求出G的最大半连通子图拥有的节点数K,以及不同的最大半连通子图…
Instantaneous Transference Time Limit: 5000MS   Memory Limit: 65536K Total Submissions: 6204   Accepted: 1389 Description It was long ago when we played the game Red Alert. There is a magic function for the game objects which is called instantaneous…
Intelligence System Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1859    Accepted Submission(s): 799 Problem Description After a day, ALPCs finally complete their ultimate intelligence syste…