I was looking at this problem A. Laptops and I found an accepted solution : https://mirror.codeforces.com/contest/456/submission/19548093.
but I don't see how it got accepted.
This solution shouldn't work for this testcase:
Am I missing something here? Sorry if it's too noobish to ask.
Auto comment: topic has been updated by hasanraj3100 (previous revision, new revision, compare).
Look at the constraints. $$$1 \leq a_i, b_i \leq n$$$. Your test case violates this constraint.
Right! Thank you very much. I didn't realize constraint is the game changer here :p