ZJOIDay2T1 BB题解】的更多相关文章

讲道理我是调不出来了... 考虑对序列按下标维护每个节点最后的树. 那么 改操作点 - 把一段连续的节点改父亲 加点/删点(注意拆成两个操作了) 插儿子 那么用seg维护一下下标, 用ETT维护Depth和MinDepth, 打标记就能维护了. ETT+Seg 细节很多,写了400行.…
题意请看absi大爷的blog http://absi2011.is-programmer.com/posts/200920.html http://absi2011.is-programmer.com/posts/200822.html DAY1 T1 最优比率树形DP? 跟最优比率生成树很像..二分Σp/Σs(暂定为f 判定过程:每个点得到一个新权值f*p[i]-s[i] 做树形dp,dp[i][j]表示以i为根的子树选j个点能得到的最大权值 dp[root][k]>0则为合法 T2 T3…
Goblin Wars Time Limit:432MS     Memory Limit:0KB     64bit IO Format:%lld & %llu Description The wizards and witches of Hogwarts School of Witchcraft found Prof. Binn's History of Magic lesson to be no less boring than you found your own history cla…
题意: 称一对字符串(A,B)是相似的,当且仅当满足以下条件: (1)字符串A和B都恰好包含N个字符: (2)A和B串中的每个字符都是小写字母的前k个字符,即A.B中只可能出现'a','b','c',...,('a'+k-1)这k个字符: (3)存在一个字符串C,满足:A+C=C+B.这里的“+”号表示字符串间的链接,即str1+str2 = str1str2,如:“aaa”+“csd”=“aaacsd”. 例如,N=3,k=4那么("aad","daa")就是相似…
Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example: Input: "babad" Output: "bab" Note: "aba" is also a valid answer. Example: Input: "cbbd" Ou…
Leetcode 5. Longest Palindromic Substring(最长回文子串, Manacher算法) Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example 1: Input: "babad" Output: "bab" Note: "aba&q…
题目链接 题目描述 给定一个字符串 s,找到 s 中最长的回文子串.你可以假设 s 的最大长度为 1000. 示例 1 输入: "babad" 输出: "bab" 注意: "aba" 也是一个有效答案. 示例 2 输入: "cbbd" 输出: "bb" 题解(中心扩展算法) public String longestPalindrome(String string) { if (null == string…
以下代码为了阅读方便,省去以下头文件: #include <iostream> #include <stdio.h> #include <math.h> #include <string.h> #include <time.h> #include <stdlib.h> #include <string> #include <bitset> #include <vector> #include <…
强行一波题解骗一个访问量好了... http://blog.csdn.net/yanqval/article/details/51457302 http://absi2011.is-programmer.com/posts/200822.html http://absi2011.is-programmer.com/posts/200920.html orz js省队神犇↑ Day1 最佳团队(team) 给一个n+1个点的树,每个点有价值pi和费用si,求一个包含根的大小为m+1的联通块,使价值…
Codeforces Round #383 (Div. 2) A. Arpa's hard exam and Mehrdad's naive cheat 题意 求1378^n mod 10 题解 直接快速幂 代码 #include<bits/stdc++.h> using namespace std; long long quickpow(long long m,long long n,long long k) { long long b = 1; while (n > 0) { if…