摘要: 思路:这题本来是要卡一手log,但数据水了,除去求gcd,就二维单调队列裸题 #include <cstdio> #include <algorithm> #include <queue> #include <stack> #include <string> #include <string.h> 阅读全文
posted @ 2020-07-14 21:52 从小学 阅读(105) 评论(0) 推荐(0)
摘要: 思路:很明显最小割,但直接跑Dinic一定会超时,所以要将原图转化成对偶图来跑最短路,至于怎么转化,建议去搜其他人的博客。 #include <cstdio> #include <algorithm> #include <queue> #include <stack> #include <strin 阅读全文
posted @ 2020-07-14 19:03 从小学 阅读(239) 评论(0) 推荐(0)
摘要: 思路:枚举三种情况, 假设三条边分别是 t1, t2, t3 且 t1 ⇐ t2 ⇐ t3。 Case1:t3 = x, 那么只要找两个小于等于 x 的且最接近 x 的数就好了,通过 map 维护集合可方便的求出。 Case1:t2 = x, 那么只要找一个最接近 x 且 ⇐ x 和一个最接近 x 阅读全文
posted @ 2020-07-14 18:57 从小学 阅读(207) 评论(2) 推荐(0)
摘要: 思路:首先将所有后缀的hash值求出来,并对每个后缀出现的次数计数, 之后枚举每个串的前缀, 假设串 a 的存在对应后缀的前缀为 s1, s2, s3, |s1| < |s2| < |s3|, 假设 s3 对应串1,串2,串4 的后缀,首先 ans += cnt[s3], 然后看 s2, 若 s2 阅读全文
posted @ 2020-07-14 17:35 从小学 阅读(164) 评论(0) 推荐(0)