0w1

Entries from 2016-08-09 to 1 day

UVA 1428 - Ping pong ( BIT )

UVa Online Judge For each candidate of umpire, the number of matches that can be held is n( contestants in left ) with value lower than umpire's value * n( contestants in right ) with value higher + n( contestants in left ) with value high…

UVA 1329 - Corporative Network ( Union Find )

UVa Online Judge Make the disjoint set remember the distance from each node to its direct father. Whenever path compression is in progress, the cost should be updated as well. struct UnionFind{ vector< int > fa, cost; UnionFind( int sz ){ …

UVA 1160 - X-Plosives ( Union Find )

UVa Online Judge Formally put, it is that given many edges through input, only connect the ones that do not form cycle, and otherwise count it in the answer. Checking whether a new edge will cause a cycle be formed can be managed by union …

UVA 11997 - K Smallest Sums ( Priority Queue, Merge )

UVa Online Judge First I thought I could simply make a structure to record where each index of the arrays are, and expand them in priority queue, however, did not work out because for example when ( 0, 1 ) and ( 1, 0 ) are both visited, ( …