- 博客(16)
- 收藏
- 关注
原创 2018焦作网络赛 H String and Times
题目链接:https://nanti.jisuanke.com/t/31717计算原串中,有多少子串的出现次数位于l和r之间,后缀自动机的题目,建立后缀自动机之后进行拓扑排序,将子节点出现的次数不断向它在parent树上的父节点追加更新,计算每个节点right集合的大小,得到的就是其代表字符串出现的次数,有时间写一篇SAM的学习笔记吧,希望能帮到像我一样刚入门的新手。。还有这道题比较坑的一...
2018-09-29 16:58:03 299
原创 hdu 5785 Interesting 回文树
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5785找出所有【i,j】为回文串【j+1,k】也为回文串的i*k乘积之和。正着扫一遍反着扫一遍,根据回文树中num数组的含义,处理出以i为末尾和以i为开头的回文串开头或者末尾的坐标和,最后对每个a[i]*b[i+1]求和即可居然卡空间,把cnt数组去掉就可以了#include<...
2018-09-19 15:58:30 349
原创 Tsinsen A1255. 拉拉队排练(陶文博) 回文树
题目链接:http://www.tsinsen.com/A1255求前k长的奇数长度的回文子串的幂之积,因为n不是很大所以基数排序+快速幂来计算数组开小居然会t长见识了#include<bits/stdc++.h>#define MOD 19930726#define For(i,m,n) for(int i=m;i<=n;i++)#define LL lo...
2018-09-11 23:42:31 161
原创 Tsinsen A1280 最长双回文串
题目链接:http://www.tsinsen.com/A1280找到最长的由连续的两个回文串构成的原串的子串,即形如AB,A和B都是回文串,但AB不一定是回文串处理出以每个点为末尾元素的最长回文串长度,再O(n)找到最长连接串#include<bits/stdc++.h>#define MOD 1000000007#define For(i,m,n) for(in...
2018-09-11 18:55:08 152
原创 ural 1960 Palindromes and Super Abilities 回文树
题目链接:https://vjudge.net/problem/URAL-1960每读一个字符,输出到当前为止有多少个不同的回文串。属于模板题#include<bits/stdc++.h>#define MOD 1000000007#define For(i,m,n) for(int i=m;i<=n;i++)#define LL long long#defi...
2018-09-11 16:42:48 150
原创 计蒜客南京赛区预选赛 skr 回文树
题目链接:https://nanti.jisuanke.com/t/30998看了两个小时才看懂,恩其实主要考的是这个知识点,变形过程不太难,整理了一下模板#include<bits/stdc++.h>#define MOD 1000000007#define For(i,m,n) for(int i=m;i<=n;i++)#define LL long lon...
2018-09-10 21:37:59 182
原创 徐州赛区网络赛 Ryuji doesn't want to study 线段树维护区间和
题目链接:https://nanti.jisuanke.com/t/31460Ryuji is not a good student, and he doesn't want to study. But there are n books he should learn, each book has its knowledge a[i]a[i].Unfortunately, the lon...
2018-09-10 19:15:57 260
原创 hdu 6053 TrickGCD 反演
题目链接;http://acm.hdu.edu.cn/showproblem.php?pid=6053最后减得时候可能会小于0所以要加模 #include<bits/stdc++.h>#include<math.h>#define MOD 1000000007#define For(i,m,n) for(int i=m;i<=n;i++)#de...
2018-09-06 20:54:13 118
原创 hdu 5663 Hillan and the girl反演+暴力筛
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5663#include<bits/stdc++.h>#include<math.h>#define MOD 20101009#define For(i,m,n) for(int i=m;i<=n;i++)#define LL long long#def...
2018-09-05 22:33:21 183
原创 nod51 1244 莫比乌斯函数之和 杜教筛
题目链接:https://vjudge.net/problem/51Nod-1244杜教筛杜教筛马克一下过几天再写 #include<bits/stdc++.h>using namespace std;typedef long long ll;const int N = 1e7 + 5;int mu[N];int prime[N], pcnt;bool...
2018-09-05 20:22:39 171
原创 南京赛区网络赛 计蒜客Sum 积性函数线性筛
题目链接:https://nanti.jisuanke.com/t/30999猜想..........f(x)是积性函数,即f(ab)=f(a)*f(b)其中a和b互质建议学习一下线性筛就会了。特殊处理n=1,n是质数以及n是质数的k次幂的情况#include<bits/stdc++.h>#include<math.h>#define MOD 20101...
2018-09-05 18:58:28 199
原创 bzoj 2301 反演+容斥
题目链接:https://www.lydsy.com/JudgeOnline/problem.php?id=2301求a<=x<=b,c<=y<=d中gcd(x,y)=k的数对对数先莫比乌斯反演求出1~a和1~b中的gcd=k的对数,在容斥一下。ans=pin(b,d)+pin(a,c)-pin(b,c)-pin(a,d);#include<bits...
2018-09-05 17:16:09 154
原创 bzoj 2154 Crash的数字表格 反演+数学
题目链接:https://www.lydsy.com/JudgeOnline/problem.php?id=2154 在这位大神的blog里才看懂,有时间再自己写一下https://www.cnblogs.com/cjyyb/p/8253033.html#include<bits/stdc++.h>#include<math.h>#define MOD...
2018-09-04 21:07:14 129
原创 hdu 6370Werewolf 并查集、思维
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6370因为狼人能说谎话也能说实话,所以所有人都有可能是狼人,能确定的村民数量为0要判断一个人是不是狼人,先假设他是村民,然后看是否有矛盾(他认为的村民说他是狼人),若有矛盾说明他是狼人,然后说他是村民的人也一定是狼人。县用并查集维护所有村民的边,然后对村民边反向建边。代码比较简单#in...
2018-09-04 15:27:16 141
原创 hdu 6373 Pinball
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6373将重力加速度分解成垂直平面与平行于平面两个分加速度,然后用时间做一下计算就ok,注意平行于斜面的距离计算要到垂直于远点o为止,而不是到y轴。#include<bits/stdc++.h>#include<math.h>#define mod 100000000...
2018-09-04 00:03:06 136
原创 计蒜客 2018南京赛区网络赛 The writing on the wall 暴力dp
题目链接:https://nanti.jisuanke.com/t/30991Feeling hungry, a cute hamster decides to order some take-away food (like fried chicken for only 3030 Yuan).However, his owner CXY thinks that take-away food...
2018-09-01 17:04:47 592
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人