0w1

Entries from 2016-10-11 to 1 day

A Simple Task of Kruskal's

Problem: Given N, N points on a 2D plane, and a value K, find the maximum D such that all points can be distributed into K non-empty subsets, where D is the minimum distance between any pair of points not in the same subset. Analysis: Cons…

Rope Trick

Problem: Given a string s, number of operations N, operations as triples ( a, b, c ), for each moves s[ a, b ] behind the xth character after the new string, output the final string. Analysis: This could be easily done with binary search t…

Template RBST by Value

A set that allows kth_element. ( Insert and remove does not allow duplicate ) struct rbst{ int val, size; ll sum; rbst *lc, *rc; rbst( int _v ) : size( 1 ), val( _v ), sum( _v ), lc( NULL ), rc( NULL ){} void pull(){ sum = val; sum += lc ?…