getting WA need help (lighoj1390 - Weight Comparison) (Category: Cycles, Topological Sorting, Strongly Connected Component)

problem link: Weight Comparison | LightOJ
my code: 1390 - Weight Comparison - Pastebin.com
verdict : WA
My idea:
did a topo sort to find an order then ran a dfs and marked cross edges and removed them. What did i miss !!!