摘要: 给你N个点的无向图 (1 <= N <= 15,000),记为:1…N。 图中有M条边 (1 <= M <= 30,000) ,第j条边的长度为: d_j ( 1 < = d_j < = 1,000,000,000). 现在有 K个询问 (1 < = K < = 15,000)。 每个询问的格式是:A B,表示询问从A点走到B点的所有路径中,最长的边最小值是多少? 阅读全文
posted @ 2017-01-03 14:31 ZegWe 阅读(1171) 评论(1) 推荐(2) 编辑
摘要: 前言 主席树,又叫函数式线段树,可持久化线段树,是一种非常有用的数据结构,我们通过一些例题来深入理解主席树的应用。 阅读全文
posted @ 2017-01-03 10:44 ZegWe 阅读(452) 评论(0) 推荐(0) 编辑
摘要: 今天终于把ZKW线段树搞出来了,也算还了一个欠账。 阅读全文
posted @ 2016-12-06 22:21 ZegWe 阅读(589) 评论(0) 推荐(0) 编辑
摘要: N (2 <= N <= 8,000) cows have unique brands in the range 1..N. In a spectacular display of poor judgment, they visited the neighborhood 'watering hole' and drank a few too many beers before dinner. When it was time to line up for their evening meal, they did not line up in the required ascending numerical order of their brands. 阅读全文
posted @ 2016-12-06 21:31 ZegWe 阅读(582) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2016-11-10 21:58 ZegWe 阅读(539) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2016-11-09 21:36 ZegWe 阅读(246) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2016-11-09 21:00 ZegWe 阅读(191) 评论(0) 推荐(0) 编辑
摘要: Squares and rectangles fascinated the famous Dutch painter Piet Mondriaan. One night, after producing the drawings in his 'toilet series' (where he had to use his toilet paper to draw on, for all of his paper was filled with squares and rectangles), he dreamt of filling a large rectangle with small rectangles of width 2 and height 1 in var 阅读全文
posted @ 2016-11-02 22:04 ZegWe 阅读(178) 评论(0) 推荐(0) 编辑
摘要: A number whose only prime factors are 2,3,5 or 7 is called a humble number. The sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 24, 25, 27, ... shows the first 20 humble numbers. Write a program to find and print the nth element in this sequence. 阅读全文
posted @ 2016-11-02 18:11 ZegWe 阅读(380) 评论(0) 推荐(0) 编辑
摘要: 不要问我静静是谁(正经脸 阅读全文
posted @ 2016-10-31 21:58 ZegWe 阅读(153) 评论(0) 推荐(0) 编辑