摘要: //p[]为最长回文半径长度,id为当前最靠右端回文串的中心点(多个取最靠左),mx为id对应的回文串的最右端坐标+1void manacher(char *s,int len){ p[0] = 1; int mx = 0 , id = 0; for(int i = 1 ;i i ? min(p[id*2 - i],mx-i) : 1; while(s... 阅读全文
posted @ 2018-10-15 12:02 mxzf0213 阅读(138) 评论(0) 推荐(0) 编辑
摘要: //对于字符串a的每个后缀,匹配它与a的第一个后缀的最长公共前缀,复杂度线性void z_algorithm(char *a,int len) { z[0]=len; for(int i=1,j=1,k;i<len;i=k) { if(j<i)j=i; while(j<len && a[j]==a[j-i])++j; z[i... 阅读全文
posted @ 2018-10-15 11:22 mxzf0213 阅读(291) 评论(0) 推荐(0) 编辑
摘要: A1484. two strings(罗干) 时间限制:1.0s 内存限制:256.0MB A1484. two strings(罗干) 时间限制:1.0s 内存限制:256.0MB 【问题描述】 给定两个字符串A和B,有五种操作,操作1为在A串开头添加一个字符,操作2为在A串结尾添加一个字符,操作 阅读全文
posted @ 2018-09-05 21:47 mxzf0213 阅读(202) 评论(0) 推荐(0) 编辑
摘要: 链接:https://www.nowcoder.com/acm/contest/140/B来源:牛客网 题目描述 White Rabbit wants to buy some drinks from White Cloud. There are n kinds of drinks, and the 阅读全文
posted @ 2018-07-24 16:36 mxzf0213 阅读(262) 评论(0) 推荐(0) 编辑
摘要: void build() { int top=0; for(int i=1;i<=n;i++) l[i]=0,r[i]=0,vis[i]=0; for(int i=1;i<=n;i++) { int k=top; while(k>0&&a[stk[k-1]]>a[i])--k; if (k) r[s 阅读全文
posted @ 2018-07-23 21:30 mxzf0213 阅读(143) 评论(0) 推荐(0) 编辑
该文被密码保护。 阅读全文
posted @ 2018-07-04 22:20 mxzf0213 阅读(5) 评论(0) 推荐(0) 编辑
摘要: 随着山东省赛的结束,18年上半年的训练至此告一段落,是时候写一波总结了。赛前一天信誓旦旦的和队友wzl说明天拿个冠军,条件是你下楼去拿外卖,队友开心的答应了。然而实际上外卖小哥超负责的把外卖送到了房间门口,还是很感动的,但是隐约感觉到一丝不妙(滑稽.jpg)。正赛的时候果然连前三都没有,倒也不觉得遗 阅读全文
posted @ 2018-05-07 21:03 mxzf0213 阅读(306) 评论(0) 推荐(0) 编辑
摘要: Problem E. Master of SubgraphYou are given a tree with n nodes. The weight of the i-th node is wi. Given a positive integer m, now you need to judge t 阅读全文
posted @ 2018-04-16 17:12 mxzf0213 阅读(468) 评论(0) 推荐(0) 编辑
摘要: Problem K. Master of SequenceTherearetwosequencesa1,a2,··· ,an, b1,b2,··· ,bn. LetS(t) =∑n i=1⌊t−bi ai ⌋. Therearemoperationswithin three kinds as fol 阅读全文
posted @ 2018-04-16 00:06 mxzf0213 阅读(477) 评论(0) 推荐(0) 编辑
摘要: XOR Consider an array AAA with n elements . Each of its element is A[i]A[i]A[i] (1≤i≤n)(1 \le i \le n)(1≤i≤n) . Then gives two integers QQQ, KKK, and 阅读全文
posted @ 2018-04-15 23:57 mxzf0213 阅读(534) 评论(0) 推荐(0) 编辑