随笔分类 - 拓扑
摘要:前面的两场感觉质量不高,就没写题解 A .Around the Track pro:给定内多边形A和外多边形B,求最短路径,蛮子路径再A之外,B之内。 sol:如果没有B,就是求凸包,有了B,我们在做凸包的时候,有形如“a-b-c,b在内部,删去b,连接a-c的操作”,如果a-c和B不相交,直接删去
阅读全文
摘要:5450: 轰炸 Description 有n座城市,城市之间建立了m条有向的地下通道。你需要发起若干轮轰炸,每轮可以轰炸任意多个城市。但每次轰 炸的城市中,不能存在两个不同的城市i,j满足可以通过地道从城市i到达城市j。你需要求出最少需要多少轮可以 对每座城市都进行至少一次轰炸。 有n座城市,城市
阅读全文
摘要:5280: [Usaco2018 Open]Milking Order Description Farmer John的N头奶牛(1≤N≤105),仍然编号为1…N,正好闲得发慌。因此,她们发展了一个与Farmer John每 天早上为她们挤牛奶的时候的排队顺序相关的复杂的社会阶层。经过若干周的研究
阅读全文
摘要:Jimmy experiences a lot of stress at work these days, especially since his accident made working difficult. To relax after a hard day, he likes to wal
阅读全文
摘要:题意:给定一个N点M边的有向图,叫你加最多K条边,使得最小拓扑序最大. 思路:不是那么简单的题. 参照了别人的代码, 最后想通了. 贪心原则: 用两个单调队列维护, 第一个序列S1单增, 表示当前入度为0的点 ; 第二个序列S2单减,表示需要加边的点. 如果S1的最大值大于S2的最大值,则对其加边.
阅读全文
摘要:Gennady and Georgiy are playing interesting game on a directed graph. The graph has n vertices and m arcs, loops are allowed. Gennady and Georgiy have
阅读全文
摘要:Recently in school Alina has learned what are the persistent data structures: they are data structures that always preserves the previous version of i
阅读全文
摘要:问题: Amateur astronomers Tom and Bob try to find radio broadcasts of extraterrestrial civilizations in the air. Recently they received some strange sig
阅读全文
摘要:Problem Description In middle school, teachers used to encourage us to pick up pretty sentences so that we could apply those sentences in our own arti
阅读全文
摘要:Problem Description 035 now faced a tough problem,his english teacher gives him a string,which consists with n lower case letter,he must figure out ho
阅读全文
摘要:描述 小Hi平时的一大兴趣爱好就是演奏钢琴。我们知道一个音乐旋律被表示为一段数构成的数列。 现在小Hi想知道一部作品中所有长度为K的旋律中出现次数最多的旋律的出现次数。但是K不是固定的,小Hi想知道对于所有的K的答案。 输入 共一行,包含一个由小写字母构成的字符串S。字符串长度不超过 1000000
阅读全文
摘要:1599 逆向bfs+优化 #include<cstdio> #include<cstdlib> #include<iostream> #include<cstring> #include<algorithm> #include<string> using namespace std; int a,
阅读全文
摘要:学到了DAG中如何记忆化(也可以按距离排序后处理)
阅读全文
摘要:HDU2767 :求一个有向图最少加几条边变成连通图(难度1.5) HDU3836:(同2767) HDU4635 :求一个有向图最多能加几条边,使得加后也不出现自环,重边,强连通分量(难度3+数学,贪心) HDU5934 :缩点后找祖先,对每个祖先,如果是一个点就引爆它,是一个缩点,就引爆里面最小
阅读全文