传送门 The k-th Largest Group Time Limit: 2000MS Memory Limit: 131072K Total Submissions: 8690 Accepted: 2847 Description Newman likes playing with cats. He possesses lots of cats in his home. Because the number of cats is really huge, Newman wants…
考试的时候用了两个树状数组去优化,暴力修改,树状数组维护修改后区间差值还有最终求和,最后骗了40分.. 这道题有好多种做法,求和好说,最主要的是开方.这道题过的关键就是掌握一点:在数据范围内,最多开方五六次就会变成1,这样以后再修改就不用修改了. ① 线段树打标记 ② 分块打标记 ③ 树状数组+并查集 因为我考试的时候用的树状数组,所以直接打的第三种,相对来说代码量也少一些. 思路:开始时父亲都指向自己,如果变成1,就把父亲指向下一个位置即可.修改的时候相当于跳着修改.代码当中会有注解.…
Stability Time Limit: 3000/2000 MS (Java/Others) Memory Limit: 65535/102400 K (Java/Others)Total Submission(s): 1347 Accepted Submission(s): 319 Problem Description Given an undirected connected graph G with n nodes and m edges, with possibly r…