上一页 1 2 3 4 5 6 7 8 9 ··· 26 下一页
摘要: 传送门:https://www.luogu.org/problem/show?pid=3613 【题解】 按二进制位分开,对于每一位,用“起床困难综合征”的方法贪心做。 写棵LCT,维护正反两种权值,每个维护2种,代表全0的输出和全1的输出。 然后直接上LCT即可。 权值的合并有点trick,可以参 阅读全文
posted @ 2017-07-07 23:21 Galaxies 阅读(175) 评论(0) 推荐(0) 编辑
摘要: 【题目大意】 一个$n$个数的序列,$m$次操作,每次选择一段区间$[l, r]$,求出$[l, r]$中出现超过一半的数。 如果没有超过一半的数,那么就把答案钦定为$s$,每次会有$k$个数进行改变,给出下标,改变成当前的答案$s$。 $n, m \leq 5*10^5, \sum k\leq 1 阅读全文
posted @ 2017-07-07 21:41 Galaxies 阅读(175) 评论(0) 推荐(0) 编辑
摘要: 代码实现参考:http://www.cnblogs.com/candy99/p/6374177.html SAM教程推荐:https://huntzhan.org/suffix-automaton-tutorial/ 阅读全文
posted @ 2017-07-06 21:29 Galaxies 阅读(431) 评论(0) 推荐(0) 编辑
摘要: 传送门:http://hihocoder.com/problemset/problem/1445 【题解】 大概看了一天的后缀自动机,总算懂了一些 这篇文章写的非常好,诚意安利:Suffix Automaton Tutorial - Hunt Zhan 我就是看了这个大概懂了。 整个过程大概是:每次 阅读全文
posted @ 2017-07-06 21:07 Galaxies 阅读(224) 评论(0) 推荐(0) 编辑
摘要: 【题目大意】 给出$n$个数$a_1, a_2, ..., a_n$,求有多少个区间$[l, r]$,满足每个数都出现了奇数次。 $1 \leq n \leq 2 * 10^5, 0 \leq a_i \leq 10^6$ 【题解】 稳爷爷出的noi模拟题(原题来自某地区ioi选拔赛) 给每个数赋一 阅读全文
posted @ 2017-07-05 22:27 Galaxies 阅读(317) 评论(0) 推荐(1) 编辑
摘要: 传送门:http://cogs.pro/cogs/problem/problem.php?pid=2652 【题解】 学习了一发长链剖分,感觉十分兹磁 广告:长链剖分 - fjzzq2002 那么我再说一遍吧,以本题为例。 题目大意:给一棵树,每个点有点权$A_i$和$B_i$,找一条长度为$m$的 阅读全文
posted @ 2017-07-05 20:17 Galaxies 阅读(714) 评论(0) 推荐(0) 编辑
摘要: 传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=1026 【题解】 基本数位dp。 写了半天发现自己太傻了。。。 # include <stdio.h> # include <string.h> # include <iostream> # i 阅读全文
posted @ 2017-07-05 17:07 Galaxies 阅读(157) 评论(0) 推荐(0) 编辑
摘要: 传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=1862 http://www.lydsy.com/JudgeOnline/problem.php?id=1056 【题解】 写到头昏脑涨(逃 写着写着发现不仅要记录权值和哈希值还需要记录插入时间 阅读全文
posted @ 2017-07-05 14:34 Galaxies 阅读(219) 评论(0) 推荐(0) 编辑
摘要: 传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=4923 【题解】 发现每次操作,对于$(k, 2k]$的数,他们会变为$(0, k]$,而对于$(2k, +\infty)$的数,他们的相对次序不变,只是打了一个区间减tag而已。 那么每次暴力 阅读全文
posted @ 2017-07-05 12:09 Galaxies 阅读(494) 评论(0) 推荐(0) 编辑
摘要: 传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=3781 【题解】 将x^2差分成1+3+5+...+(x+x-1)即可莫队了。顺手3min码出来了(兹磁啊) 复杂度$O(n\sqrt{n})$ # include <math.h> # inc 阅读全文
posted @ 2017-07-04 23:18 Galaxies 阅读(187) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 ··· 26 下一页