Palindromic characteristics of string s with length |s| is a sequence of |s| integers, where k-th number is the total number of non-empty substrings of s which are k-palindromes. A string is 1-palindrome if and only if it reads the same backward as f…
The Cartesian coordinate system is set in the sky. There you can see n stars, the i-th has coordinates (xi, yi), a maximum brightness c, equal for all stars, and an initial brightness si (0 ≤ si ≤ c). Over time the stars twinkle. At moment 0 the i-th…
Two boys decided to compete in text typing on the site "Key races". During the competition, they have to type a text consisting of s characters. The first participant types one character in v1 milliseconds and has ping t1 milliseconds. The secon…
[Link]:http://codeforces.com/contest/835/problem/D [Description] 给你一个字符串; 让你在其中找到1..k阶的回文子串; 并统计它们的数量 如果一个字符串是一个回文串,则它可以是1阶子串; k阶字符串,要求它的左边和右边都是k-1阶子串; [Solution] bo[i][j]表示i..j这一段是否为回文; 可以用O(n2)的复杂度处理出整个bo数组; 然后O(n2)枚举每一段区间; 算出这个区间的字符串最大可以是一个几阶字符串记为…
Some natural number was written on the board. Its sum of digits was not less than k. But you were distracted a bit, and someone changed this number to n, replacing some digits with others. It's known that the length of the number didn't change. You h…
n people are standing on a coordinate axis in points with positive integer coordinates strictly less than 106. For each person we know in which direction (left or right) he is facing, and his maximum speed. You can put a bomb in some point with non-n…
题目大意: 给定n m k:(1≤n≤1e5, 0≤m≤200, 1≤k≤1e5) 表示n个时间长度内 最多被打扰m次 k个红包 接下来k行描述红包 s t d w:(1≤s≤t≤d≤n , 1≤w≤1e9) 表示在 s 到 t 的时间内都可开始获得该红包 该红包在时间 d 时才能完成获得 红包内有w硬币 在同一时间段内只能获得一个红包 不能同时获得两个及以上 求在被打扰的情况下使获得的红包硬币最少 是多少 用in out标记各红包可被获得的区间 用multiset维护在某个时间点可获得的红包有…
证明在Tutorial的评论版里 /* CodeForces 835D - Palindromic characteristics [ 分析,DP ] | Codeforces Round #427 (Div. 2) 题意: 定义 k 回文串满足: 1. 左右子串相等 2. 左右子串为k-1回文串 1 回文串 就是回文串 问你字符串s的子串的每阶回文子串的数目 分析: 研究一下可以发现 k 回文串的要求等价于 1. 本身是回文串 2. 左右子串是k-1回文串 然后可以dp了,还有一个结论是: 若…
s <= c是最骚的,数组在那一维开了10,第八组样例直接爆了- - /* CodeForces 835C - Star sky [ 前缀和,容斥 ] | Codeforces Round #427 (Div. 2) 题意: 有一片 100*100 的星空,上面有 n 颗星星,每个星星有一个亮度,且在 0~C 范围内周期性变化,现在给出 q 个查询,每个查询给出时间和一个矩形,求在该时间时矩形内星星的亮度和. c <= 10 分析: 由于 c <= 10,则星星的亮度只有11种情况,全部…
本来准备好好打一场的,然而无奈腹痛只能带星号参加 (我才不是怕被打爆呢!) PROBLEM C - Star sky 题 OvO http://codeforces.com/contest/835/problem/C 835C 解 由于题目中给的c很小,可以对应每种亮度分别保存(c+1)个矩阵 然后初始化一下求前缀矩阵 每次询问就可以O(c)求出答案 (Accepted) #include <iostream> #include <cstring> #include <cst…