拓扑排序
小菜鸡加油
菜鸡
什么都能折磨
展开
-
D. Substring(思维+拓扑排序dp)
https://codeforces.com/problemset/problem/919/D 思路: 开始看错题目是无向图,莽了一手暴力发现题意理解错误。 通过拓扑排序后就可以转移到达每个点的字符的最大次数是多少。O(26n) 转移是每次遍历到的时候更新。入queue是度数为0 #include<iostream> #include<vector> #include<queue> #include<cstring> #include<cma原创 2021-03-10 14:51:58 · 133 阅读 · 0 评论 -
C. Journey(DAG上dp详解)
https://codeforces.com/problemset/problem/721/C 题目描述 Recently Irina arrived to one of the most famous cities of Berland — the Berlatov city. There arennshowplaces in the city, numbered from11tonn, and some of them are connected by one-directional r...原创 2020-09-06 12:11:31 · 276 阅读 · 0 评论