Question : https://mirror.codeforces.com/contest/1183/problem/E
I want to know how it can be done using 1.Graphs 2.Dynamic Programming
Also there is a harder version of the problem. [problem:https://mirror.codeforces.com/contest/1183/problem/H] What changes do i need to make for this in my approach?
P.S my rating is 1600. Any help is appreciated Thanks