CF1062F Upgrading Cities】的更多相关文章

题意 一张 \(n\) 点 \(m\) 边的 \(DAG\) ,问有多少个点满足最多存在一个点不能够到它或者它不能到. \(n,m\leq 3\times 10^5\) 分析 考虑拓扑排序,如果 \(A\) 能够到 \(B\) ,那么 \(A,B\) 一定不能同时存在于队列中. 所以如果队列中同时存在的点超过了2个,队列中的点都是不合法的. 如果队列中只有一个点,那么剩下的没进队的点他都可以到达:如果队列中有两个点 \(a,b\),且 \(b\) 能够到达一个入度为1的点 \(c\),此时 \(…
题意 由于这是个\(DAG\),我们考虑拓朴排序,求某个点能到的和能到它的点,这是两个问题,我们可以正反两边拓朴排序,这样就只用考虑它能到的点了 设\(f[x]\)表示\(x\)能到的点数\(+\)能到\(x\)的点数 如果在拓朴排序的过程中: \(q.size()==1\),显然当前队首\(x\)能到达剩下的所有点,中途记录出现在队列中的点的个数\(tot\),\(f[x]+=n-tot\) \(q.size()==2\),记录队列中的两点\(x,y\),对于\(y\),如果\(y\)存在\(…
CF79D Password: 差分.两点取反,本质是匹配!最短路+状压DP 取反是套路,匹配是发现可以把操作进行目的化和阶段化,从而第二次转化问题. 且匹配不会影响别的位置答案 sequence 计算最长极长段小于等于j的方案数 突破口是i,k总共对数nlogn级别,干掉j用组合意义大力推导 CF1062F Upgrading Cities DAG考虑topo,关键性质:topo序队列中点两两不可达.只在队列长度<=2时候才关心. CF1060F Shrinking Tree 考虑x是不是rt…
A. A Prank Solved. 题意: 给出一串数字,每个数字的范围是$[1, 1000]$,并且这个序列是递增的,求最多擦除掉多少个数字,使得别人一看就知道缺的数字是什么. 思路: 显然,如果缺的这块数字的个数刚好等于右界 - 左界 + 1 那么就可以知道 还需要考虑数据范围,因为是$<= 1000  和 >= 1$ 那么对于两边的边界需要特殊考虑. #include <bits/stdc++.h> using namespace std; #define N 110 in…
A:A Prank 题意:给定一个递增序列, 问最多能删除多少个连续数字,要求删除数字之后能还原成原来的数列. 题解:直接找就好了,为了方便可以使得第0个数字为0, 第n+1个元素为1001 代码: #include<bits/stdc++.h> using namespace std; #define Fopen freopen("_in.txt","r",stdin); freopen("_out.txt","w&quo…
Connect the Cities Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 18322 Accepted Submission(s): 4482 Problem DescriptionIn 2100, since the sea level rise, most of the cities disappear. Though some…
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…
CF449B CF450D http://codeforces.com/contest/450/problem/D http://codeforces.com/contest/449/problem/B Codeforces Round #257 (Div. 2) D Codeforces Round #257 (Div. 1) B D. Jzzhu and Cities time limit per test 2 seconds memory limit per test 256 megaby…
VS2013: upgrading a Windows Phone 7/8 and Windows 8 apps September 17, 2013Windows 8, Windows PhoneJeremy In this post I will showcase issues I had while upgrading a Visual Studio 2012 solution containing a Windows Phone app (with both 7.8 and 8.0 ve…
Cumulative Feature Overview Identifies product features available to you when upgrading. This tool requires Microsoft Excel. Any user should consult this document, as needed. Note: Make sure to enable macros when prompted to do so. Otherwise, the Mic…