摘要: 欢迎来到我的博客! 阅读全文
posted @ 2017-11-15 20:21 MSPqwq 阅读(435) 评论(4) 推荐(0) 编辑
摘要: #include<cstdio>#include<algorithm>#include<cstring>#include<cmath>#define N 10005using namespace std;int n,m,u,v,qr,que[N];struct node{ int fa,lc,rc, 阅读全文
posted @ 2018-03-01 20:33 MSPqwq 阅读(135) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #define N 200005 using namespace std; int buf1[N],buf2[N],sa[N],rnk[N],buc[N],n,height[N],ans,belong[N]; char s[N]; void suffix_sort() { int *x=buf1,*y=buf2,m=1000; ... 阅读全文
posted @ 2018-02-24 11:14 MSPqwq 阅读(608) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #define N 20005 using namespace std; int buf1[N],buf2[N],sa[N],rnk[N],buc[N],n,height[N],ans,Log[N],pos,Min[N][25]; char s[N]; void suffix_sort() { int *x=buf1,*y=buf2,... 阅读全文
posted @ 2018-02-24 09:55 MSPqwq 阅读(181) 评论(0) 推荐(0) 编辑
摘要: 题目链接 阅读全文
posted @ 2018-02-23 08:35 MSPqwq 阅读(133) 评论(0) 推荐(0) 编辑
摘要: 题目: http://www.lydsy.com/JudgeOnline/problem.php?id=1096 题解: 阅读全文
posted @ 2018-02-01 20:49 MSPqwq 阅读(145) 评论(0) 推荐(0) 编辑
摘要: 题目: https://www.luogu.org/problemnew/show/P2906 题解: 垃圾水题 阅读全文
posted @ 2018-02-01 16:46 MSPqwq 阅读(141) 评论(0) 推荐(0) 编辑
摘要: 原题: http://www.lydsy.com/JudgeOnline/problem.php?id=1010 题解: 阅读全文
posted @ 2018-01-31 20:46 MSPqwq 阅读(167) 评论(0) 推荐(0) 编辑
摘要: 题目: 给n个数字,一段合法区间[l,l+m-1]要求max-min<=c 输出所有合法区间的左端点,如果没有输出NONE 题解: 单调队列同时维护最大值和最小值 阅读全文
posted @ 2018-01-31 19:23 MSPqwq 阅读(185) 评论(0) 推荐(0) 编辑
摘要: 放一手原题 题解: 第一次写(抄)斜率优化,心里还是有点小激动的。讲一下怎么实现的! 首先我们可以考虑一个朴素的dp:DP[i]表示前i个数字的最少花费,显然我们有一个转移方程 DP[i]=min{DP[j]+M+(sum[i]-sum[j])^2} 但是N^2肯定会超时,我们考虑优化他 假设有k< 阅读全文
posted @ 2018-01-30 21:01 MSPqwq 阅读(159) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #define N 1000005 using namespace std; int q[N],a[N],n,m,l,r=-1; int main() { scanf("%d%d",&n,&m); for (int i=1;i=l) l++; while (a[q[r]]>a[i] && r>=l) r--; ... 阅读全文
posted @ 2018-01-30 20:37 MSPqwq 阅读(136) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #define p 1000000007 typedef long long ll; using namespace std; ll n,a,b,cnt[5],ok,ans[5]; inline ll pw(ll m,ll n) { ll b = 1; while (n > 0) { ... 阅读全文
posted @ 2018-01-16 17:25 MSPqwq 阅读(114) 评论(0) 推荐(0) 编辑
摘要: 题目: http://www.lydsy.com/JudgeOnline/problem.php?id=1013 题解: 考虑二维的我们可以明白一个道理: 两个点左边可以表示一个方程,然后用两两方程相减得到一个一次方程 这样用高斯消元就可以做了 阅读全文
posted @ 2018-01-10 14:58 MSPqwq 阅读(147) 评论(0) 推荐(0) 编辑
摘要: 题目: http://poj.org/problem?id=3621 题解: 二分答案,检查有没有负环 阅读全文
posted @ 2018-01-10 08:44 MSPqwq 阅读(257) 评论(0) 推荐(0) 编辑
摘要: 题目: http://poj.org/problem?id=2728 题解: 二分比率,然后每条边边权变成w-mid*dis,用prim跑最小生成树就行 阅读全文
posted @ 2018-01-10 08:41 MSPqwq 阅读(170) 评论(0) 推荐(0) 编辑
摘要: 题目: http://poj.org/problem?id=2976 题解: 枚举答案 如果最大的n-k个a[i]-mid*b[i]之和大于等于0就OK否则不OK 阅读全文
posted @ 2018-01-09 20:06 MSPqwq 阅读(106) 评论(0) 推荐(0) 编辑
摘要: 题目: http://acm.hdu.edu.cn/showproblem.php?pid=2089 题解: 暴力水过 阅读全文
posted @ 2018-01-09 11:20 MSPqwq 阅读(167) 评论(0) 推荐(0) 编辑
摘要: 题目: http://www.lydsy.com/JudgeOnline/problem.php?id=1026 题解: f[i][j][1/0]表示枚举到第i位,这位开头是j,当前的数大于(1)或小于(0)目标数的Windy数个数 瞎JB转移即可 阅读全文
posted @ 2018-01-09 11:16 MSPqwq 阅读(177) 评论(0) 推荐(0) 编辑
摘要: 不是我吹牛逼 想了1min就想出来的题真是 超水的 题太简单了 解释就不解释了 阅读全文
posted @ 2018-01-09 09:07 MSPqwq 阅读(160) 评论(0) 推荐(0) 编辑
摘要: 题目: http://www.lydsy.com/JudgeOnline/problem.php?id=2064 题解:又自己写的 是个水题 超开心 的 阅读全文
posted @ 2018-01-09 07:58 MSPqwq 阅读(102) 评论(0) 推荐(0) 编辑
摘要: 题目: http://poj.org/problem?id=3254 题解: 把一行压成一个状态 这样枚举每行,枚举这行和上行的状态,判断合法然后转移 阅读全文
posted @ 2018-01-08 19:52 MSPqwq 阅读(124) 评论(0) 推荐(0) 编辑