Problem : A New Order
PROBLEM LINK
MY CODE
I tried to solve this question using topological sort but I got only partial points. Please Help.
Codeforces Round 941 (Div 1 + 2) Solution Discussion (with Jan)