首先dfs,记录每个点第一次被访问到的时间 那么区间LCA其实就是访问最早和访问最晚的点的LCA 找时间最早和最晚用ST表,找LCA用倍增 ...
分类:
其他好文 时间:
2017-08-07 20:30:03
阅读次数:
125
Coach Pang loves his boyfriend Uncle Yang very much. Today is Uncle Yang’s birthday, Coach Pang wants to have a romantic candlelit dinner at Uncle Yan ...
分类:
其他好文 时间:
2017-08-02 23:24:54
阅读次数:
212
pog loves szh II Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 2106 Accepted Submission(s): 60 ...
分类:
其他好文 时间:
2017-08-02 13:15:13
阅读次数:
154
恢复内容开始 The little girl loves the problems on array queries very much. One day she came across a rather well-known problem: you've got an array of n el ...
分类:
其他好文 时间:
2017-07-31 01:10:50
阅读次数:
164
Petya loves lucky numbers. Everybody knows that positive integers are lucky if their decimal representation doesn't contain digits other than 4 and 7. ...
分类:
其他好文 时间:
2017-07-30 00:54:06
阅读次数:
169
题目大意:很多人@一个人,如果那个人忍不住说话了,就轰炸成功,如果那个人没说话或者别的人没有@他或@很多个人,则轰炸失败。(具体见原题) 解题思路:字符串处理,好好用sscanf即可(细节见代码)。 C++ Code: ...
分类:
其他好文 时间:
2017-07-28 09:52:51
阅读次数:
210
对于正整数n,定义f(n)为n所含质因子的最大幂指数。例如f(1960)=f(2^3 * 5^1 * 7^2)=3, f(10007)=1, f(1)=0。 给定正整数a,b,求sigma(sigma(f(gcd(i,j)))) (i=1..a, j=1..b)。 Input 第一行一个数T,表示询 ...
分类:
其他好文 时间:
2017-07-27 23:37:28
阅读次数:
356
DZY has a hash table with p buckets, numbered from 0 to p?-?1. He wants to insert n numbers, in the order they are given, into the hash table. For the ...
分类:
其他好文 时间:
2017-07-25 16:35:36
阅读次数:
180
题意:n张牌,选k个排成一圈,给出L,求出最大R 使得[L,R]内任意一个数 都可以由圈内连续m个数异或得到.n<=20,k<=6,a[i],L<=100. m为自己设定的. 暴力 总共有A(20,6)种方案 每种方案k^2算出异或数 TLE..先C(20,6)选出方案 若能过最优性剪支,在全排列更 ...
分类:
其他好文 时间:
2017-07-23 18:22:50
阅读次数:
118
英文题面: De Prezer loves movies and series. He has watched the Troy for like 100 times and also he is a big fan of Supernatural series.So, he did some re ...
分类:
其他好文 时间:
2017-07-22 23:44:01
阅读次数:
220