Codechef Problem – Krillin is dead AGAIN

The link to problem : https://www.codechef.com/problems/KRILLIN Solution I would like you to read about segment trees before further reading solution if you don't know as it is a prerequisite for this problem. http://codeforces.com/blog/entry/15890 https://codeforces.com/blog/entry/18051 Now we will build our segment tree in which each node will be storing frequency i.e. the array's elements, the value(index) and … Continue reading Codechef Problem – Krillin is dead AGAIN

Codechef Problem – Total Diamonds

The link to problem : https://www.codechef.com/problems/VK18 Solution Let us consider an example for n=6. The room numbers for following 36 rooms can be written as 2   3   4   5   6   7 3   4   5   6   7   8 4   5   6   7   8   9 5   6   7   8   9   10 6   7   8   9  10  11 7  … Continue reading Codechef Problem – Total Diamonds

Codeforces Problem – Useful Decomposition

The link to problem : http://codeforces.com/contest/981/problem/C Solution The question says that there should be atleast one vertex common for every path and we shall be able to visit every node without repeating any edge. For this we need to firstly make adjacency list for the given inputs. When we have made adjacency list then we need … Continue reading Codeforces Problem – Useful Decomposition