摘要:
时间复杂度O(NlogN)+O(Q) int a[N]; int dpmax[N][20],dpmin[N][20]; void first(int n) { mm(dpmax,0); mm(dpmin,0); rep(i,1,n+1) { dpmin[i][0]=dpmax[i][0]=a[i]; 阅读全文
摘要:
A rooted tree is a well known data structure in computer science and engineering. An example is shown below: In the figure, each node is labeled with 阅读全文
摘要:
Mike and !Mike are old childhood rivals, they are opposite in everything they do, except programming. Today they have a problem they cannot solve on t 阅读全文
摘要:
Tom owns a company and he is the boss. There are n staffs which are numbered from 1 to n in this company, and every staff has a ability. Now, Tom is g 阅读全文
摘要:
In Land waterless, water is a very limited resource. People always fight for the biggest source of water. Given a sequence of water sources with a1,a2 阅读全文
摘要:
Write a program that takes as input a rooted tree and a list of pairs of vertices. For each pair (u,v) the program determines the closest common ances 阅读全文
摘要:
因为是最长上升的,可以用一个数组储存上升的序列,如果后一个数字比数组的最大数字还大,就加到末尾去,如果不大于,那么就可以把这个数组中比他大的数字替换掉,因为如果数字更小,后面上升序列更长的可能性更大,这样也不会改变之前最大的数字;最小同理 阅读全文
摘要:
1.ST表+时间戳 DFS记录这棵树每个点出现的时间1 2 3 2 4 2 5 2 1 6 7 8 7 6 1。 然后用ST表记录每个区间的min值,然后进行q次查询,时间复杂度O(Nlog2N+Qlog2N); include include include include include inc 阅读全文
摘要:
"来源" 作为2013年699万应届毕业生中的一员,由于宏观经济的不景气,小明在毕业当天就华丽丽地失业了! 经历了千难万苦的求职过程,小明特别能理解毕业生的就业之难,所以,他现在准备创建一家专门针对IT人才的求职中介公司——非诚勿扰人力资源开发有限公司。 基于工作的需要,小明根据求职学生的简历描述为 阅读全文
摘要:
"来源poj2263" Big Johnsson Trucks Inc. is a company specialized in manufacturing big trucks. Their latest model, the Godzilla V12, is so big that the am 阅读全文