A.Color the Simple Cycle(polya计数+字符串匹配) 此题的难点在于确定置换的个数,由a[i+k]=a[i], e[i+k]=e[i]联想到KMP. 于是把原串和原串扩大两倍的目标串进行字符串匹配就能求出具体的置换. 这里的算法可以使用hash或者kmp. 然后套polya公式就行了. #include <iostream> #include <cstdio> #include <cmath> #include <vector> #…
A.A + B problem(待填坑) B.Cat VS Dog(二分图匹配) 喜欢cat和喜欢dog的人构成了二分图,如果两个人有冲突则连一条边,则问题转化为二分图最大点独立集问题.ans=n-最大匹配. # include <cstdio> # include <cstring> # include <cstdlib> # include <iostream> # include <vector> # include <queue&g…
Rank:56/147. 开场看B,是个线段树区间合并,花了2hour敲完代码...再花了30min查错..发现push_down有问题.改了就AC了. 然后发现A过了很多人.推了个公式,发现是个分段函数.取个中间点代进去结果就AC了. C好像也很水?看了看原来是个傻逼BFS.A了. F化解了一下就 集合子集异或为0的种数.想了想没想到什么东西就go die了. A.Liang Guo Sha(阅读理解) 看懂题意后搞出两个式子,然后取个极值就行了. # include <cstdio> #…
AC: F I. rank 40/88. 开场看了F发现是个简单的DP,随便写了一下WA,,,发现把样例倒着输就过不了了...原来是忘了最后的时候开始上课的话可能上不了多久... 想到一个简洁的状态方程,然后以为是单调队列优化,突然发现好像只需要求个最小值就行了...改改AC了.. 看榜发现I过了很多,看了一下就是个同色三角形裸题..A了然后就没有然后了... 看了一下B.第一感觉KMP,感觉通配符的情况不大好处理...没学AC自动机... C.求多边形的对称轴...但是枚举对称轴好像会TLE?…
打了4hours,做出一道题...太菜了.rank:45/107 开场看B,题目看不懂...3hours半才发现i<=N-1,不是i<=x-1.然而还是不会. 看到J有人过了,发现是个简单的树形DP,先处理出根节点的贡献,再O(1)向下转移..于是49min A了J. 然后就没有任何题会了... A?坐标范围这么大?离散化后好像还是无法搞... B?差分?怎么差都差不出... C?不会数论... D?刚开始写了一个自认为正确的DP+矩阵快速幂,然而发现好像无法处理颜色的排列不允许的情况...然…
2015 UESTC Winter Training #8 The 2011 Rocky Mountain Regional Contest Regionals 2011 >> North America - Rocky Mountain 开始时貌似是UVAlive挂了,无论交什么都WA,后来转战HDU 这次水题比较多,其中B题据说有更加高级的方法. G题WA了两发,才发现竟然没有输出Case!!! 未完成:D F H I J A - Iterated Difference 水题,模拟迭代即可…
Redraw Beautiful Drawings Time Limit: 3000/1500 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Problem Description Alice and Bob are playing together. Alice is crazy about art and she has visited many museums around the world. She has…
任意门:http://acm.hdu.edu.cn/showproblem.php?pid=6319 Problem A. Ascending Rating Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java/Others)Total Submission(s): 5943    Accepted Submission(s): 2004 Problem Description Before…
tree Time Limit: 8000ms Memory Limit: 262144KB This problem will be judged on HDU. Original ID: 539064-bit integer IO format: %I64d      Java class name: Main   Given a rooted tree(node 1 is the root) with n nodes. The ithnode has a positive value vi…
Area of Mushroom Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 2390    Accepted Submission(s): 578 Problem Description Teacher Mai has a kingdom with the infinite area. He has n students guard…
Differencia Time Limit: 10000/10000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 601    Accepted Submission(s): 173 Problem Description Professor Zhang has two sequences a1,a2,...,an and b1,b2,...,bn. He wants to…
Rigid Frameworks Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 337    Accepted Submission(s): 273 Problem Description Erik Demaine is a Professor in Computer Science at the Massachusetts Insti…
2012 Multi-University Training Contest 9 / hdu4389 打巨表,实为数位dp 还不太懂 先这样放着.. 对于打表,当然我们不能直接打,这里有技巧.我们可以这样:每隔100000我们统计一次,这样在10^9范围内,我们得到10000个数. 然后就很好解决了... 数位dp:http://blog.csdn.net/acdreamers/article/details/9318727 #include<iostream> #include<cst…
2014 Multi-University Training Contest 9#11 Killing MonstersTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 562    Accepted Submission(s): 308 Problem Description Kingdom Rush is a popular TD…
2014 Multi-University Training Contest 9#6 Fast Matrix CalculationTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 424    Accepted Submission(s): 219 Problem Description One day, Alice and Bob…
8/11 2016 Multi-University Training Contest 1 官方题解 老年选手历险记 最小生成树+线性期望 A Abandoned country(BH) 题意: 1. 求最小生成树 2. 求在某一棵最小生成树任意两点的最小距离的期望值. 思路: 首先题目说了边权值都是不同的,所以最小生成树唯一.那么只要统计出最小生成树的每一条边在“任意两点走经过它“的情况下所贡献的值,发现在一棵树里,一条边所贡献的次数为,sz[v]表示v子树包括节点v的个数.如下图所示,红边所…
8/13 2016 Multi-University Training Contest 2官方题解 数学 A Acperience(CYD)题意: 给定一个向量,求他减去一个  α(>=0)乘以一个值为任意+1或-1的B向量后得到向量,求这个向量膜的最小值思路: 展开式子,当时最小,结果为. 代码: #include <bits/stdc++.h> using namespace std; long long w,a,b,c,a2; long long gcd(long long x,l…
5/11 2016 Multi-University Training Contest 3官方题解 2016年多校训练第三场 老年选手历险记 暴力 A Sqrt Bo(CYD) 题意:问进行多少次开根号向下取整能使给定的值为1,若为5次以上,则输出TAT: 思路: 有5次这个限制,得知值最大为10的11次方左右,存下后运算即可,注意初始值为0时运算的次数是大于5次的,输出TAT: 代码: #include <bits/stdc++.h> using namespace std; char st…
6/12 2016 Multi-University Training Contest 4官方题解 KMP+DP A Another Meaning(CYD) 题意: 给一段字符,同时给定你一个单词,这个单词有双重意思,字符串中可能会有很多这种单词,求这句话的意思总数:hehe. 思路: 可以用kmp算法快速求出串中的单词数量,若单词是分开的,每个单词有两种意思,可以直接相乘,若两个及以上单词在原串中是有交集的,那么数量不是直接相乘,发现这片连在一起的单词数量dp[i]=dp[i-1]+dp[j…
6/12 2016 Multi-University Training Contest 5 期望+记忆化DP A ATM Mechine(BH) 题意: 去ATM取钱,已知存款在[0,K]范围内,每一次输入取出钱的金额,如果大于存款,ATM会发出警报,最多W次,问能在W次内取出所有存款的取款次数的期望值. 思路: 设dp[k][w]表示范围存款在[0,k]内,还有w次报警机会的期望值.状态转移方程: 代码: #include <bits/stdc++.h> const int N = 2e3…
5/12 2016 Multi-University Training Contest 6 官方题解 打表找规律/推公式 A A Boring Question(BH) 题意: ,意思就是在[0,n]里选择m个数字的相邻数字二项式组合的积的总和. 思路: 想了好久,不会,但是这题有300多人过,怀疑人生... 打了个表: n=0, m=2, ans=1n=1, m=2, ans=3n=2, m=2, ans=7n=3, m=2, ans=15n=4, m=2, ans=31n=5, m=2, a…
PowMod Time Limit: 3000/1500 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 1008    Accepted Submission(s): 341 Problem Description Declare:k=∑mi=1φ(i∗n) mod 1000000007 n is a square-free number. φ is the Euler's…
Subway Time Limit: 7000/3500 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 860    Accepted Submission(s): 126Special Judge Problem Description jiefangxuanyan and yiyi cat are universally acknowledged model couple…
Game Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 588    Accepted Submission(s): 146 Problem Description   Sea5 and wzh are playing games. There are some guards on an n × m chessboard. Every…
solved 7/11 2016 Multi-University Training Contest 10 题解链接 分类讨论 1001 Median(BH) 题意: 有长度为n排好序的序列,给两段子序列[l1,r1],[l2,r2]构成新的序列,问中间的数字. 思路: 根据不同情况分类讨论即可.时间复杂度O(1). 代码: #include <bits/stdc++.h> const int N = 1e5 + 5; int a[N]; int n, m; int l1, r1, l2, r…
solved 1/13 2016 Multi-University Training Contest 9 二分+最大权闭合图 Less Time, More profit(BH) 题意就是有n个工厂,m个商店 每个工厂有建造时间ti,花费payi 每个商店和k个工厂有关,如果这k个工厂都建造了,那么能获利proi 问你求收益(∑pro−∑pay)≥L时,首先满足时间t最小,其次是收益p最大 首先二分时间的答案,然后看那些工厂能建造,然后工厂是花费,商店是收益,并且要与商店有关的工厂都建造了,才能…
solved 4/11 2016 Multi-University Training Contest 8 贪心 1001 Ball(BH) 代码: #include <bits/stdc++.h> const int N = 1000 + 5; std::pair<int, int> a[N]; int n, m; int main() { int T; scanf ("%d", &T); while (T--) { scanf ("%d%d&…
6/12 2016 Multi-University Training Contest 7 期望 B Balls and Boxes(BH) 题意: n个球放到m个盒子里,xi表示第i个盒子里的球的数量,求V的期望值. 思路: 官方题解: 代码: #include <bits/stdc++.h> typedef long long ll; ll GCD(ll a, ll b) { return b ? GCD (b, a % b) : a; } int main() { ll n, m; wh…
  Time Limit: 5000MS   Memory Limit: 65536KB   64bit IO Format: %I64d & %I64u Description Give you a sequence of N(N \leq 100, 000) integers : a_{1},...,a_{n}(0 < a_{i} \leq 1000, 000, 000). There are Q (Q \leq 100, 000) queries. For each query l,…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4930 Fighting the Landlords Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others) Total Submission(s): 312    Accepted Submission(s): 100 Problem Description Fighting the…