拓扑排序
爱上键盘的小哥哥
这个作者很懒,什么都没留下…
展开
-
Ordering Tasks(拓扑排序)
John has n tasks to do. Unfortunately, the tasks are not independent and the execution of one task is only possible if other tasks have already been executed. Input The input will consist of s原创 2017-07-26 12:04:56 · 361 阅读 · 0 评论 -
确定比赛名次
有N个比赛队(1<=N<=500),编号依次为1,2,3,。。。。,N进行比赛,比赛结束后,裁判委员会要将所有参赛队伍从前往后依次排名,但现在裁判委员会不能直接获得每个队的比赛成绩,只知道每场比赛的结果,即P1赢P2,用P1,P2表示,排名时P1在P2之前。现在请你编程序确定排名。 Input 输入有若干组,每组中的第一行为二个数N(1<=N<=500),M;其中N表示原创 2017-07-26 09:44:07 · 286 阅读 · 0 评论 -
919D. Substring(拓扑排序+dp)
You are given a graph with n nodes and m directed edges. One lowercase letter is assigned to each node. We define a path's value as the number of the most frequently occurring letter. For example, if ...原创 2018-02-13 22:29:45 · 283 阅读 · 0 评论 -
915D. Almost Acyclic Graph( 拓扑排序判环)
You are given a directed graph consisting of n vertices and m edges (each edge is directed, so it can be traversed in only one direction). You are allowed to remove at most one edge from it.Can you ma...原创 2018-02-21 11:00:17 · 233 阅读 · 0 评论