自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(97)
  • 收藏
  • 关注

转载 Edu73 F Choose a Square (线段树)

题意在平面上有 \(n\) 个点, 已知每个点的 \((x, y)\) 及其权值 \(c\),现要求在直线 \(y = x\) 上选择正方形的左下角与右上角,使得正方形(含边界)所覆盖点的权值和 与 边长的差值最大,边长可为0,求最大差值并输出可行方案。传送门思路既然正方形的一条对角线在 \(y = x\) 上,则可以在将点坐标离散化之后枚举右上角的坐标 \(y\) ,求 \([...

2019-09-21 00:47:00 141

转载 hdu 2609 How many (最小表示法)

题意给 \(n\) 个循环串,求本质不同串的数量传送门思路最小表示法求下标,从最小下标处作为串的起点,将新串放到map中去重,最终map中的元素数量即为最终答案。最小/大表示法Code#include <cstdio>#include <cstring>#include <map>#include <string>u...

2019-09-13 14:57:00 159

转载 hdu3374 String Problem(最小值表示法 + KMP)

题意给一个循环串,从某个点开始会得到一个字典序最小的串,从某个点开始会得到一个字典序最大的串,求这两个点的下标,以及其出现的次数。传送门思路最小/大表示法求下标,kmp求出现次数。最小/大表示法Code#include <cstdio>#include <cstring>using namespace std;const int maxn ...

2019-09-13 14:44:00 140

转载 hdu6704 K-th occurrence(后缀数组+RMQ+主席树)

题意给定一个长度为 \(n\) 的字符串,有 \(q\) 次询问,每次询问求字符串的 \([l, r]\) 所形成的子串第 \(k\) 次出现时的位置。传送门思路\([l, r]\) 形成的子串,它是一些后缀的前缀,并且这些前缀在后缀数组中的rk是相邻的,因此,对于\([l, r]\) 我们可以通过 rmq/lcp 求出他的区间公共前缀长度,之后二分长度大于等于 \(r-l+1\...

2019-08-25 22:26:00 135

转载 洛谷 P3809 【模板】后缀排序

题意后缀数组板子题传送门Code#include <bits/stdc++.h>using namespace std;const int maxn = 1e6+10;int n;char str[maxn];struct SuffixArray { int x[maxn], y[maxn], c[maxn]; int sa[maxn],...

2019-08-24 22:24:00 68

转载 hdu2222 【AC自动机】Keywords Search

题意给定n个模式串,求目标串中出现了多少个模式串。传送门思路AC自动机模版题。Code#include <bits/stdc++.h> using namespace std;const int maxn = 1e6+10;struct Ac { int tr[maxn][26], fail[maxn], e[maxn], cnt[maxn]; ...

2019-08-22 23:15:00 81

转载 2019杭电多校十 1011 Make Rounddog Happy(rmq + 分治)

题意有一个大小为 \(n ,(n \leq 3e5)\) 的序列,序列中的每一个数 \(a_i\) 满足\(1 \leq a_i \leq n\),现定义 good subarray:对于一段区间\(a_l, a_{l+1}, \dots, a_r\),满足区间内无重复元素并且 \(\max\{a_l, a_{l+1}, \dots, a_r\} - (r-l+1) \leq k\)...

2019-08-22 23:07:00 103

转载 Separate String(Ac自动机+dp)

题意给出大小为 \(n\) 的字符串集合,给定字符串 \(t\) ,求拆分 \(t\) 的方案数,要求串 \(t\) 拆分后每一个串都要是集合中的某个串。答案取模1e9+7思路对于一个串 \(t\) 的第i个位置,如果他是某个串的结尾, 并且这个串之前的串也是个合法串,那么可进行dp转移,可用ac自动机的fail指针来维护第 \(i\) 个位置是否为某个串的结尾并遍历集合中所有合...

2019-08-21 00:54:00 117

转载 2019杭电多校二 I Love Palindrome String(回文自动机)

题意给定一个串,求各长度下,本质不同的回文串并且回文串的左右两个字串也是回文串的数量。传送门思路题意比较绕,理顺下来就是在回文树的每个节点,求其节点对应回文串的一半是否也是回文串,如果是,则其对该节点的长度产生贡献, 判断其回文串的一半是否也为回文串可以用马拉车或者哈希,哈希相对好写一点。回文树学习Code#include <bits/stdc++.h>us...

2019-08-20 10:58:00 110

转载 2019牛客多校第八场 A All-one Matrices

链接:https://ac.nowcoder.com/acm/contest/888/A来源:牛客网题目描述Gromah and LZR entered the great tomb, the first thing they see is a matrix of size n×mn\times mn×m, and the elements in the matrix are all...

2019-08-11 12:57:00 97

转载 HDU2451 Simple Addition expression(数位dp/找规律)

题意对于一个非负整数 i, 当 \(i + (i+1) + (i+2)\) 计算过程中不产生进位时,称i满足条件, 求 小于n的 i 的个数。传送门思路数位dp。Code#include <bits/stdc++.h> using namespace std;typedef long long ll;ll dp[20][5], n;int a[20], ...

2019-08-09 00:01:00 105

转载 P3808 【模板】AC自动机(简单版)

题意AC自动机模版题。传送门Code#include <bits/stdc++.h>using namespace std;const int maxn = 1e6+10;int fail[maxn], e[maxn], tree[maxn][26], tot;void insert(char *t) { int p = 0; for (i...

2019-08-08 23:43:00 65

转载 Codeforces 126B Password(kmp)

题意给定一个字符串,求其子串,该子串即是前缀又是后缀,也是既非前缀也非后缀的字串。传送门思路前缀数组的灵活应用,对于即使后缀也是前缀的子串,判断是否在之前出现过即可。Code#include <bits/stdc++.h>using namespace std;const int maxn = 1e6+10;char str[maxn];int nxt[...

2019-08-06 10:42:00 99

转载 字符串模版

#include <bits/stdc++.h>using namespace std;const int maxn = 1e5+10;char s[maxn], t[maxn];int nxt[maxn], ext[maxn], f[maxn], p[maxn];//kmpvoid getNext(char *t) { nxt[0] = 0; ...

2019-08-05 23:31:00 75

转载 HDU6625 three arrays (字典树+贪心)

题意给定两个长度为1e5的数组a、b,在对a、b数组分别重新排序后,求相同长度的数组c,使得c[i]=a[i] xor b[i],使得数组 c 的字典序最小。思路分别对a、b建字典树,能走\(11/00\)就走,否则就走\(01/10\),找出最小的n个数,从小到大排序之后即为所求数组。Code#include <bits/stdc++.h> using nam...

2019-08-05 20:52:00 88

转载 HDU 6621 K-th Closest Distance(主席树+二分)

题意对于大小为n的正整数数组a,有q次询问,每次询问给出整数数p、k,要求输出离p第k近的数字,强制在线。思路主席树维护区间 \([l, r]\) 数字出现次数,二分答案。Code #include <bits/stdc++.h>using namespace std;typedef long long ll;const int maxn = 1e5+...

2019-08-05 20:29:00 89

转载 2018焦作网络赛 E Jiu Yuan Wants to Eat(线段树+树链剖分)

题意对一个有1e5个点,点权初值为0的树上进行4种操作:1、结点u到结点v上的所有点权乘x。2、结点u到结点v上所有的点权加x。3、结点u到结点v上所有的点权取非。4、结点u到结点v路径上点权的和。答案模\(2^{64}\)思路对操作1、2树链剖分加线段树维护即可,对操作3,取非操作为:一个二进制位上都为1的数减去当前值,即:\(2^{64}-1-x\) , 由于答案模...

2019-08-03 18:27:00 122

转载 12770 小L的有向图

题意 首先,我们定义一个图的价值为其合法拓扑序的个数。对于一张n个点,m条边的有向图, 它的每一条都可能消失,求其所有形态的价值的和。\(n \leq 22, m \leq n \times (n-1)\)数据保证没有重边,自环(x到y的边和y到x的边不算重边)。第一个问题:给定一个有向图,求拓扑排序生成的序列数。首先,我们要明白什么是拓扑序(如果知道什么是拓扑序请略过)...

2019-07-06 00:47:00 183

转载 Haiku(状压dp)

题目描述对于一个长度问n的数组A,设第i个元素为Ai(0≤i<n)。问有多少个长度为n的数组A,满足1≤Ai≤10,且这个数组是诗。给定x,y,z,一个长度为n的数组是诗当且仅当存在i,j,k,l(0≤i<j<k<l≤N)使得:ai+ai+1+...+aj−1=x。aj+aj+1+...+ak−1=y。ak+ak+1+...+al−1=z。输入一行...

2019-05-26 22:34:00 186

转载 洛谷省选——单调队列

T1题意花盆给出n个点的坐标,以及时间差d。求区间内y坐标的最大值与最小值差大于等于d 的最小x轴区间长度。 (n<=1e5, d<=1e6, x,y<=1e6)### 思路设l为一段满足条件的区间的左端点,r为该区间最小右端点,则r具有单调性。『 单调性证明:设端点l1满足条件的最小右端点为r1, 端点l2(l2>=l1)满足条件的最小右端点为r2...

2019-05-26 20:23:00 318

转载 Janken Master(概率dp/状压dp)

题目描述You are supposed to play the rock-paper-scissors game. There are N players including you.This game consists of multiple rounds. While the rounds go, the number of remaining players decrease...

2019-05-26 20:21:00 162

转载 Jurisdiction Disenchantment(二维尺取)

题目描述The Super League of Paragons and Champions (SLPC) has been monitoring a plot by a corrupt politician to steal an election. In the past week, the politican has used a mind-control technique t...

2019-05-26 20:19:00 200

转载 L3-016

L3-016二叉搜索树的结构(30分)二叉搜索树或者是一棵空树,或者是具有下列性质的二叉树: 若它的左子树不空,则左子树上所有结点的值均小于它的根结点的值;若它的右子树不空,则右子树上所有结点的值均大于它的根结点的值;它的左、右子树也分别为二叉搜索树。(摘自百度百科)给定一系列互不相等的整数,将它们顺次插入一棵初始为空的二叉搜索树,然后对结果树的结构进行描述。你...

2019-03-26 12:51:00 74

转载 Tree Burning(前后缀和)

题目链接:https://atcoder.jp/contests/agc030/tasks/agc030_b题意:  在一个有 L 个单位长度的圆上有 n 个点, 小明位于 0 位置的人要按照步骤把 n 个点走完。  圆的单位下标为[0, L-1],每个点有一个位置x[i] 。  步骤:  1、如果所有的点都被走完,游戏结束。  2、小明选择顺时针或者...

2019-03-10 19:31:00 137

转载 POJ 1151 Atlantis

There are several ancient Greek texts that contain descriptions of the fabled island Atlantis. Some of these texts even include maps of parts of the island. But unfortunately, these maps describe...

2018-10-24 19:47:00 83

转载 Antisymmetry(马拉车)

问题 H: 【哈希和哈希表】Antisymmetry时间限制:1 Sec内存限制:128 MB提交:13解决:3[提交] [状态] [讨论版] [命题人:admin]题目描述对于一个0/1字符串,如果将这个字符串0和1取反后,再将整个串反过来和原串一样,就称作「反对称」字符串。比如00001111和010101就是反对称的,而1001就不是。现在给出一个长...

2018-10-10 21:33:00 152

转载 icpc 2018 北京网络赛 A(搜索)

Saving Tang Monk II时间限制:1000ms单点时限:1000ms内存限制:256MB描述《Journey to the West》(also 《Monkey》) is one of the Four Great Classical Novels of Chinese literature. It was written ...

2018-09-22 23:37:00 72

转载 8010: Mountaineers

贵有恒,何必三更起五更眠;最无益,莫过一日曝十日寒。8010: Mountaineers时间限制:3 Sec内存限制:128 MB提交:20解决:9[提交] [状态] [讨论版] [命题人:admin]题目描述The Chilean Andes have become increasingly popular as a destination for ...

2018-09-12 23:29:00 174

转载 2018 徐州网络赛 J

131072KAfter the long vacation, the maze designer master has to do his job. A tour company gives him a map which is a rectangle. The map consists ofN \times MN×Mlittle squares. That...

2018-09-12 23:26:00 107

转载 2018 徐州网络赛 I

262144KMur loves hash algorithm, and he sometimes encrypt another one's name, and call him with that encrypted value. For instance, he calls Kimura KMR, and calls Suzuki YJSNPI. One d...

2018-09-12 23:25:00 64

转载 2018 徐州网络赛 H

Ryuji is not a good student, and he doesn't want to study. But there are n books he should learn, each book has its knowledgea[i]a[i].Unfortunately, the longer he learns, the fewer he gets....

2018-09-12 23:24:00 79

转载 2018 徐州网络赛 F

Morgana is learning computer vision, and he likes cats, too. One day he wants to find the cat movement from a cat video. To do this, he extracts cat features in each frame. A cat feature is a t...

2018-09-12 23:23:00 66

转载 2018 徐州网络赛 C

262144KMorgana is playing a game called cacti lottery. In this game, morgana has a3 \times 33×3grid graph, and the graph is filled with11~99, each number appears only once. The ...

2018-09-12 23:20:00 109

转载 2018 徐州网络赛 B

262144KIn a world where ordinary people cannot reach, a boy named "Koutarou" and a girl named "Sena" are playing a video game. The game system of this video game is quite unique: in t...

2018-09-12 23:19:00 86

转载 2018 徐州网络赛A

262144KAfter Incident, a feast is usually held in Hakurei Shrine. This time Reimu asked Kokoro to deliver a Nogaku show during the feast. To enjoy the show, every audience has to wear...

2018-09-12 23:18:00 84

转载 2018 徐州网络赛 G

There's a beach in the first quadrant. And from time to time, there are sea waves. A wave (xx,yy) means the wave is a rectangle whose vertexes are (00,00), (xx,00), (00,yy), (x...

2018-09-10 20:08:00 78

转载 Split The Tree(dfs序+树状数组)

Split The Tree时间限制:1 Sec内存限制:128 MB提交:46解决:11[提交] [状态] [讨论版] [命题人:admin]题目描述You are given a tree with n vertices, numbered from 1 to n. ithvertex has a value wiWe define the weig...

2018-09-05 19:04:00 201

转载 A Question of Ingestion(Dp)

A Question of Ingestion时间限制:1 Sec内存限制:128 MB提交:95解决:26[提交] [状态] [讨论版] [命题人:admin]题目描述Stan Ford is a typical college graduate student, meaning that one of the most important things...

2018-09-03 20:01:00 98

转载 Starting a Scenic Railroad Service(前缀和+差分)

Starting a Scenic Railroad Service时间限制:2 Sec内存限制:128 MB提交:59解决:21[提交] [状态] [讨论版] [命题人:admin]题目描述Jim, working for a railroad company, is responsible for planning a new tourist tra...

2018-08-29 22:03:00 181

转载 Rendezvous on a Tetrahedron (模拟)

Rendezvous on a Tetrahedron时间限制:1 Sec内存限制:128 MB提交:6解决:4[提交] [状态] [讨论版] [命题人:admin]题目描述One day, you found two worms P and Q crawling on the surface of a regular tetrahedron with ...

2018-08-29 21:53:00 152

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除