hash+二分求出最长公共前缀 然后马拉车+前缀和计数 #include <cstdio> #include <cstring> #include <queue> #include <cmath> #include <algorithm> #include <set> #include <iostream> #include <map> #include <stack> #include <s…
layout: post title: Mediocre String Problem (2018南京M,回文+LCP 3×3=9种做法 %%%千年好题 感谢"Grunt"大佬的细心讲解) author: "luowentaoaa" catalog: true mathjax: true tags: - 回文树 - 马拉车 - 扩展KMP - 后缀数组 - 后缀自动机 - 字符串哈希 题意 给出一个串S,和一个串T. 要求 从S串中取一个子串,后面接上T串的一个前缀…
Mediocre String Problem 题解: 很容易想到将第一个串反过来,然后对于s串的每个位置可以求出t的前缀和它匹配了多少个(EXKMP 或者 二分+hash). 然后剩下的就是要处理以某个位置为结束的回文串有多少个(manacher + 差分),因为要求s串选取的要多一点.这道题是个痛啊...当时的金牌题,不会EXKMP可以用二分+字符串hash啊,比赛前的暑假还写过,比赛时就没想到,还以为KMP可以搞出这个东西, 然后就三个人一起自闭地调KMP,说到底还是菜呀. 代码: #pr…
题目链接:https://nanti.jisuanke.com/t/30991 2000ms 262144K   Feeling 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 is unhealthy and expensive. So she…
A square-free integer is an integer which is indivisible by any square number except 11. For example, 6 = 2 \cdot 36=2⋅3 is square-free, but 12 = 2^2 \cdot 312=22⋅3 is not, because 2^222 is a square number. Some integers could be decomposed into prod…
ACM-ICPC 2018 南京赛区网络预赛 E题 题目链接: https://nanti.jisuanke.com/t/30994 Dlsj is competing in a contest with n (0 < n \le 20)n(0<n≤20) problems. And he knows the answer of all of these problems. However, he can submit ii-th problem if and only if he has s…
题目链接:https://nanti.jisuanke.com/t/30991 Feeling 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 is unhealthy and expensive. So she demands her hams…
J. Sum 26.87% 1000ms 512000K   A square-free integer is an integer which is indivisible by any square number except 11. For example, 6 = 2 \cdot 36=2⋅3 is square-free, but 12 = 2^2 \cdot 312=22⋅3 is not, because 2^222 is a square number. Some integer…
A. An Olympian Math Problem 54.28% 1000ms 65536K   Alice, a student of grade 66, is thinking about an Olympian Math problem, but she feels so despair that she cries. And her classmate, Bob, has no idea about the problem. Thus he wants you to help him…
轻轻松松也能拿到区域赛名额,CCPC真的好难 An Olympian Math Problem 问答 只看题面 54.76% 1000ms 65536K   Alice, a student of grade 66, is thinking about an Olympian Math problem, but she feels so despair that she cries. And her classmate, Bob, has no idea about the problem. T…