会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
ToRapture
博客园
首页
新随笔
联系
订阅
管理
上一页
1
2
3
4
5
6
7
下一页
2019年11月14日
Manacher算法
摘要: [kuangbin专题] Manacher 实现参考了https://oi-wiki.org/string/manacher/。 POJ 3974 Palindrome 求字符串$A$的最长回文子串模板题,首先在$A$的第一个字符的左面和$A$的每个字符的后面填充不在输入范围内的字符$,得到串$S$
阅读全文
posted @ 2019-11-14 14:57 ToRapture
阅读(119)
评论(0)
推荐(0)
2019年11月5日
最短路算法
摘要: https://hihocoder.com/problemset/problem/1093 实现参考了算法导论。 #include <bits/stdc++.h> #define DBG(x) cerr << #x << " = " << x << endl using namespace std;
阅读全文
posted @ 2019-11-05 18:35 ToRapture
阅读(132)
评论(0)
推荐(0)
2019年10月31日
子串Hash
摘要: 模板 const int N = 1000000 + 16; struct Hash { const unsigned long long KEY = 137; unsigned long long h[N], p[N]; int len; void init(const int a[], int
阅读全文
posted @ 2019-10-31 14:52 ToRapture
阅读(168)
评论(0)
推荐(0)
2019年10月30日
[Offer收割]编程练习赛108
摘要: https://hihocoder.com/contest/offers108/problems A 再买优惠 暴力或二分一下 #include <bits/stdc++.h> #define DBG(x) cerr << #x << " = " << x << endl using namespa
阅读全文
posted @ 2019-10-30 19:55 ToRapture
阅读(157)
评论(0)
推荐(0)
2019年4月26日
计蒜客38229 Distance on the tree 树剖
摘要: 按照查询的边权w排序,离线add和query,注意树剖处理边权时的特殊逻辑。 #include <bits/stdc++.h> #define DBG(x) cerr << #x << " = " << x << endl #define lrrt int L, int R, int rt #def
阅读全文
posted @ 2019-04-26 16:02 ToRapture
阅读(151)
评论(0)
推荐(0)
2019年4月24日
计蒜客38228 Max answer 单调栈 + 线段树
摘要: Max answer 与POJ 2796 Feel Good类似,但是这个题有负数,需要特殊处理一下 #include <bits/stdc++.h> #define DBG(x) cerr << #x << " = " << x << endl using namespace std; typed
阅读全文
posted @ 2019-04-24 17:15 ToRapture
阅读(155)
评论(0)
推荐(0)
2018年8月31日
Leetcode 85. Maximal Rectangle
摘要: 令$sum_{i, j}\(表示从\)(i, j)\(开始沿着\)(i - 1, j), (i - 2, j) \dots (0, j)$方向的连续的$1$的个数, \[ sum_{i, j} = \begin{cases} 0 & m_{i, j} \ne 1 \\ 1 + sum_{i - 1,
阅读全文
posted @ 2018-08-31 23:14 ToRapture
阅读(166)
评论(0)
推荐(0)
2017年9月19日
Codeforces 103D Time to Raid Cowavans 分块
摘要: 有数组$A[N], 1\le N \le 3 \cdot 105$, $P$次查询,对于每次查询给出$pos$和$k$,求$\sum\limits_{pos + m \cdot k \le N} A[pos + m \cdot k]$。 把所有查询按$k$分组,$k \le \sqrt N$的组$O
阅读全文
posted @ 2017-09-19 17:21 ToRapture
阅读(152)
评论(0)
推荐(0)
Poj 2352 Stars
摘要: 简单二维偏序 #include <cstdio> #include <cstring> #include <iostream> #include <algorithm> #include <vector> #define DBG(x) cerr << #x << " = " << x << endl
阅读全文
posted @ 2017-09-19 17:06 ToRapture
阅读(126)
评论(0)
推荐(0)
HDU 6203 ping ping ping LCA + 贪心
摘要: 有一个$N+1$个结点的树$T$。 现在有$Q$个信息,每条信息为$q:(u,v)$,表示$u$到$v$的路径不通。 问树$T$至少被破坏多少个节点才能达到当前这种局面。 #include <bits/stdc++.h> #define DBG(x) cerr << #x << " = " << x
阅读全文
posted @ 2017-09-19 17:05 ToRapture
阅读(113)
评论(0)
推荐(0)
上一页
1
2
3
4
5
6
7
下一页
公告