Sorting It All Out Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 39602 Accepted: 13944 Description An ascending sorted sequence of distinct values is one in which some form of a less-than operator is used to order the elements from s
3832: [Poi2014]Rally Time Limit: 20 Sec Memory Limit: 128 MBSec Special JudgeSubmit: 168 Solved: 84[Submit][Status][Discuss] Description An annual bicycle rally will soon begin in Byteburg. The bikers of Byteburg are natural long distance cyclists
CF798E. Mike and code of a permutation 题意: 排列p,编码了一个序列a.对于每个i,找到第一个\(p_j > p_i\)并且未被标记的j,标记这个j并\(a[i]=j\).给出a求一个可行的p,保证有解.\(n \le 500000\) 官方题解很详细 令\(b(i) = a^{-1}(i)\),也就是说\(b_i\)表示i被谁标记了 容易想到把小于关系用边表示然后拓扑排序 将没有的a和b置为n+1 我们从题目中能直接得到两种小于关系:\((i,b_i)\
题意:一个图有n个点,n条边,定义D(u,v)为u到v的距离,S(u,k)为所有D(u,v)<=k的节点v的集合 有m次询问(0<=k<=2): 1 u k d:将集合S(u,k)的所有节点的权值加d 2 u k:询问集合S(u,k)的所有节点的权值之和 析:把这个图树成两部分,一个是一个环,然后剩下的森林. 这个环可以用拓扑来求,看这个博客吧,讲的非常细了. http://blog.csdn.net/qq_31759205/article/details/75049074 代码如下:
DZY Loves Topological Sorting Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5195 Description A topological sort or topological ordering of a directed graph is a linear ordering of its vertices such that for ev
DZY Loves Topological Sorting Problem Description A topological sort or topological ordering of a directed graph is a linear ordering of its vertices such that for every directed edge (u→v) from vertex u to vertex v , u comes before v in the ordering