0w1

Entries from 2016-09-05 to 1 day

CFR 580 E. Kefa and Watch ( Hashing + Segment Tree )

Problem - E - Codeforces Seems like there were cases that deliberately hacked those who used only one MOD value for hashing, where such hack tests can easily be prepared with a little knowledge of birthday paradox. First, it might be a lit…

CFR 580 D. Kefa and Dishes ( bit DP )

Problem - D - Codeforces I thought this resembled quite a lot with this problem. What we really have to do is to perform dynamic programming on: dp[ S ][ i ] : the value of having each element in set S eaten and i'th as the last int bit_co…

CFR 580 C. Kefa and Park ( DFS )

Problem - C - Codeforces Not much do I really need to mention. We will only have to traverse the graph with a single DFS. void dfs( const vvi &G, const vi &has_cat, int cat_cnt, int u, int fa, int &ans ){ if( has_cat[ u ] ) ++cat_cnt; // c…

CFR 580 B. Kefa and Company ( Deque )

Problem - B - Codeforces If the friends are sorted such that each of their money is in ascending order, any valid combinations, having maximised the largest value, will be a contiguous segment. Hence we will apply crawling technique to fin…