partial sort. first use std::nth_element to find pivot, then use std::stable_partition with the pivot to partition the largest k, whose indices are in acsending order, print them in reverse order. p.s. lambda expression is also used. STL is powerful.…
胜利大逃亡(续) Time Limit : 4000/2000ms (Java/Other)   Memory Limit : 65536/32768K (Java/Other) Total Submission(s) : 22   Accepted Submission(s) : 10 Font: Times New Roman | Verdana | Georgia Font Size: ← → Problem Description Ignatius再次被魔王抓走了(搞不懂他咋这么讨魔王喜…
The 3n + 1 problem Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 53927   Accepted: 17142 Description Problems in Computer Science are often classified as belonging to a certain class of problems (e.g., NP, Unsolvable, Recursive). In th…
Largest Rectangle in a Histogram Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 11706    Accepted Submission(s): 3219 Problem Description A histogram is a polygon composed of a sequence of rec…
Tempter of the Bone Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 70032    Accepted Submission(s): 19286 Problem Description The doggie found a bone in an ancient maze, which fascinated him a…
FatMouse' Trade Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 42953    Accepted Submission(s): 14336 Problem Description FatMouse prepared M pounds of cat food, ready to trade with the cats g…
Drainage Ditches Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 8861    Accepted Submission(s): 4141 Problem Description Every time it rains on Farmer John's fields, a pond forms over Bessie's…
Uncle Tom's Inherited Land* Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 1869    Accepted Submission(s): 777 Special Judge Problem Description Your old uncle Tom inherited a piece of land fr…
C. Hard problem time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vasiliy is fond of solving different tasks. Today he found one he wasn't able to solve himself, so he asks you to help. Vasil…
three version are provided. disjoint set, linked list version with weighted-union heuristic, rooted tree version with rank by union and path compression, and a minor but substantial optimization for path compression version FindSet to avoid redundanc…