The Problem to Slow Down You Problem's Link: http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=141572 Mean: 给你两个字符串,求这两个字符串相同回文串的匹配对数. analyse: 每个字符串建一棵回文树,分别从0结点和1结点两棵树一起往下dfs,对于同一条路径上的结点,一定是相同的回文,然后两个的数量相乘加到answer中. Time complexity: O(N)…
Description Long long ago, there lived two rabbits Tom and Jerry in the forest. On a sunny afternoon, they planned to play a game with some stones. There were n stones on the ground and they were arranged as a clockwise ring. That is to say, the firs…
Mart Master II Time Limit: 12000/6000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 675 Accepted Submission(s): 237 Problem Description Trader Dogy lives in city S, which consists of n districts. There are n - 1…
Clone Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/65536K (Java/Other) Total Submission(s) : 8 Accepted Submission(s) : 5 Font: Times New Roman | Verdana | Georgia Font Size: ← → Problem Description After eating food from Chernobyl,…
#include <bits/stdc++.h> #define Sigma 30 #define MAXN 500010 #define int long long using namespace std ; int n, m, ans ; char s[MAXN], t[MAXN] ; struct PAM{ int rt0, rt1, last, sz, f[MAXN], ch[MAXN][Sigma], fail[MAXN], len[MAXN] ; void Init(){ sz =…
#include <bits/stdc++.h> #define Sigma 30 #define MAXN 500010 #define int long long using namespace std ; int n, m, ans1, ans2 ; char s[MAXN], t[MAXN] ; struct PAM{ int rt0, rt1, last, sz, f[MAXN], ch[MAXN][Sigma], fail[MAXN], len[MAXN] ; void Init(…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5029 Problem Description The soil is cracking up because of the drought and the rabbit kingdom is facing a serious famine. The RRC(Rabbit Red Cross) organizes the distribution of relief grain in the disa…
Problem Description You are given a tree with N nodes which are numbered by integers 1..N. Each node is associated with an integer as the weight. Your task is to deal with M operations of 4 types: 1.Delete an edge (x, y) from the tree, and then add a…
G - Grade Ted is a employee of Always Cook Mushroom (ACM). His boss Matt gives him a pack of mushrooms and ask him to grade each mushroom according to its weight. Suppose the weight of a mushroom is w, then it’s grade s is s = 10000 - (100 - w)^2What…
Problem Description After eating food from Chernobyl, DRD got a super power: he could clone himself right now! He used this power for several times. He found out that this power was not as perfect as he wanted. For example, some of the cloned objects…
传说的SB DP: 题目 Problem Description Lee has a string of n pearls. In the beginning, all the pearls have no color. He plans to color the pearls to make it more fascinating. He drew his ideal pattern of the string on a paper and asks for your help. In eac…
1001 A Curious Matt 1002 Black And White 1003 Collision 1004 Dire Wolf 1005 Everlasting L 1006 Fluorescent 1007 GRE Words Once More! 1008 Happy Matt Friends 1009 Intersection 1010 Just A Mistake 1011 K.Bro Sorting…
题解: https://files.cnblogs.com/files/clrs97/19HKEditorial-V1.zip Code:(Part) A. Axis of Symmetry #include<cstdio> #include<algorithm> #include<vector> using namespace std; typedef long long ll; const int N=100010,inf=1000000010; int Case,…