codechef Counting D-sets】的更多相关文章

Counting on a directed graph Problem Code: GRAPHCNT All submissions for this problem are available. Read problems statements in Mandarin Chineseand Russian. Given an directed graph with N nodes (numbered from 1 to N) and M edges, calculate the number…
难度 \(hard\) 题意 官方中文题意 做法 为避免数重,强制每维至少有一个\(0\),这个可以简单容斥 直径恰好为\(d\),不好求,也容斥一下…
https://vjudge.net/problem/CodeChef-TAPAIR 合法的删除方法: 第一种:桥边与其余任意边(1)桥*(桥-1)/2(两条桥边)(2)桥*(m-桥)(桥边+其他边)第二种:两条非桥边:一定在同一个边双内对每一个边双求dfs树(1)两条树边(定义覆盖:反向边(a,b)覆盖了dfs树上a到b路径中每一条边)显然,任意边覆盖的路径中都是深度递减/递增的一些点如果两条树边被完全相同的边集覆盖,那么显然(感性理解)它们处在相同的环的中,因此同时去掉能让这些环断开两个口子…
问题描述 给出一张有向图,可能存在环,对于所有的i,求出从1号点到i点的所有路径上的必经点集合. 什么是支配树 两个简单的小性质—— 1.如果i是j的必经点,而j又是k的必经点,则i也是k的必经点. 2.如果i和j都是k的必经点,则i和j之间必然存在必经点关系,不可能互相都不是必经点. 不难发现所有的必经点关系形成了一个以1点为根的树形关系,每个点的支配点集合就是其到根节点(1点)路径上的点集,称这棵树为支配树. 怎么求支配树 假如我们得到的是一个有向无环图,那么只需要$O(N)$的做一遍拓扑排…
传送门--Vjudge 第一问很氵,如果\(K,N\)同奇偶就是\(2^K-1\),否则就是\(2^K-2\) 第二问似乎是可重排列,考虑指数型生成函数. 如何限制某些数必须要出现奇数/偶数次?考虑\(\frac{e^x-e^{-x}}{2}\),可以发现它的展开式中只有次数为奇数的项有值,而\(\frac{e^x+e^{-x}}{2}\)只有次数为偶数的项有值. 于是当\(K,N\)同奇偶时答案是\(N!(\frac{e^x-e^{-x}}{2})^K\),否则是\(N!(\frac{e^x-…
传送门 题意:给出一个$N$个点.$M$条边的无向连通图,求有多少组无序数对$(i,j)$满足:割掉第$i$条边与第$j$条边之后,图变为不连通.$N \leq 10^5 , M \leq 3 \times 10^5$ 竟然随机化,歪果仁的思想好灵活qwq肯定是数据结构做多了 看起来很像割边,考虑$tarjan$,但是边三连通分量并不是很好实现,而且有很多特殊情况需要判断,所以我们考虑另外的算法 考虑$tarjan$时建出的一棵树.对于它来说,在一个端点在其下方.另一个端点在其上方的的返祖边可以…
Ant Counting Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 4982   Accepted: 1896 Description Bessie was poking around the ant hill one day watching the ants march to and fro while gathering food. She realized that many of the ants were…
Counting The Problem Gustavo knows how to count, but he is now learning how write numbers. As he is a very good student, he already learned 1, 2, 3 and 4. But he didn't realize yet that 4 is different than 1, so he thinks that 4 is another way to wri…
题目连接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=247&page=show_problem&problem=3666 13764622 1225 Digit Counting Accepted C++11 0.035 2014-06-18 07:44:02 1225 - Digit Counting Time limit: 3.000 seconds Tru…
Ant Counting Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 131072/65536K (Java/Other) Total Submission(s) : 3   Accepted Submission(s) : 2 Problem Description Bessie was poking around the ant hill one day watching the ants march to and fro w…