首先会想到|x|是不递减的. 于是可以枚举长度L. 再每个L设一个断点,xx必定经过两个断点. 两两断点间求最长公共前后缀,这里用hash+二分会快. 然后一波扫过去就好了. 如果找到了,hash就要重构. 来计算一下复杂度. 一共有O(n log n)个断点,每个求最长公共前后缀复杂度log,这一部分是O(n log^2 n ) 长度小于 \(L \leq n\)的最多 \(n\sqrt n\)次,\(L\geq n\)最多 \(n\sqrt n\)中,所以重构复杂度: \(O(n \sqrt…
D. Have You Ever Heard About the Word? time limit per test 6 seconds memory limit per test 256 megabytes input standard input output standard output A substring of a string is a contiguous subsequence of that string. So, string bca is substring of st…
最近做了好多CF的题的说,很多cf的题都很有启发性觉得很有必要总结一下,再加上上次写题解因为太简单被老师骂了,所以这次决定总结一下,也发表一下停课一星期的感想= = Codeforces 261E Maxim and Calculator 描述:有两个变量a和b,初始值为1和0,每次有两种操作,一个是a=a*b,另一个是b++,求有多少个l<a<r能在p步内达到(p<=100,r<1e9) 首先观察到p最大为100,也就是说最大质因数小于p,打表可得一共大概只有300万个数 考虑d…
Word Cut Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Practice CodeForces 176B Description Let's consider one interesting word game. In this game you should transform one word into another through specia…
A. Magic Numbers 不能出现连续的3个4,以及1.4以外的数字. B. Ping-Pong (Easy Version) 暴力. C. Malek Dance Club 考虑\(x\)二进制每一位1,假设位置为\(p\),则前\(p-1\)位都需要一样,否则之前就计算了贡献,那么后面的位可以任取. D. Psychos in a Line 链表模拟. E. Kalila and Dimna in the Logging Industry 因为\(b_n=0\),所以用最小代价砍倒第…
B. Urbanization 题目链接 http://codeforces.com/contest/735/problem/B 题面 Local authorities have heard a lot about combinatorial abilities of Ostap Bender so they decided to ask his help in the question of urbanization. There are n people who plan to move…
Sereja and Mugs Time Limit: 1000MS   Memory Limit: 262144KB   64bit IO Format: %I64d & %I64u Submit Status Description Sereja showed an interesting game to his friends. The game goes like that. Initially, there is a table with an empty cup and n wate…
Space Golf 题目连接: http://codeforces.com/gym/100803/attachments Description You surely have never heard of this new planet surface exploration scheme, as it is being carried out in a project with utmost secrecy. The scheme is expected to cut costs of c…
C. Fox And Names 题目连接: http://codeforces.com/contest/510/problem/C Description Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: "Fox"). She heard a rumor: the authors list on the paper is always sorted in…
H. Mysterious Photos Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100187/problem/H Description Everyone probably heard the rumours about the constellation of Bermuda Triangle: any person who looks to this constellation of th…