Solution idea ???
problem link : https://codeforces.com/gym/101972/problem/C
CF Edu Round #165 Solution Discussion
Educational Round 165 Solution Discussion (with myself)