Gym - 100548G The Problem to Slow Down You】的更多相关文章

依然是回文树. 我们只需要吧siz[]改成统计两边的siz[][0/1],然后把两个字符中间随便加一个不会出现的字符拼起来,做一遍回文树统计一下就OJBK了 #include<bits/stdc++.h> #define ll unsigned long long using namespace std; const int maxn=500005; int T,n,len[maxn],sum[maxn][2],zt,m,p; int ch[maxn][27],fl[maxn],cnt,now…
The Problem to Slow Down You Time Limit: 20000ms Memory Limit: 524288KB This problem will be judged on CodeForcesGym. Original ID: 100548G64-bit integer IO format: %I64d      Java class name: (Any)   After finishing his homework, our problem setter F…
The Problem to Slow Down You Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=93645#problem/G Description http://7xjob4.com1.z0.glb.clouddn.com/76e435d3c21fa3cbeef1e76780086dc4 Input   Output Sample In…
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)…
The Problem to Slow Down You 输入:t个测试样例,每个样例输入两个字符串 输出:这两对字符串的回文串可以组成多少对本质不同的回文串 题意:给你两个字符串,然后问你这两字符串中 有多少对本质不同的字符串子序列 #include<iostream> #include<stdio.h> #include <algorithm> #include <string> #include<string.h> #include<…
Problem B. Geometry ProblemTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=88926#problem/B Description Peter is studying in the third grade of elementary school. His teacher of geometry often gives h…
https://vjudge.net/problem/UVALive-7041 题意 给出两个仅包含小写字符的字符串 A 和 B : 求:对于 A 中的每个回文子串,B 中和该子串相同的子串个数的总和. 分析 从0和1两个根节点DFS下去,如果两个相同的节点同时存在就统计答案. #include <iostream> #include <cstdio> #include <cstdlib> #include <cstring> #include <st…
题目链接: https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=5053 先把第一个串插入回文树中,然后把s数组清空插入第二个串,统计两个cnt数组,答案是二者相乘的结果 #include <iostream> #include <stdlib.h> #include <algorithm> #…
题目链接:http://codeforces.com/gym/100548 今天晚上突然有了些兴致去学习一下数据结构,然后就各种无意中看到了Palindrome Tree的数据结构,据说是2014年新出的数据结构,也让我回想起了西安打铁时候的经历.这道题的题意其实是比较清晰的,给你两个长度200000的字符串,求它们有多少对回文子串.处理字符串有许多常用的工具,像后缀数组,后缀自动机,AC自动机,KMP,但是这些数据结构在针对回文串的处理上都不是特别强,当然稍微处理一下我们还是可以很好的利用好上…
Problem C.   The Problem Needs 3D Arrays Time Limit: 6000MS Memory Limit: 262144KB 64bit IO Format: %I64d & %I64u Description A permutation is a sequence of integers p1,p2,...,pn, consisting of n distinct positive integers and each of them does not e…