Hello, I have been trying to solve the ADAAPHID - Ada and Aphids problem(https://www.spoj.com/problems/ADAAPHID/) for past 2 days, but I’m still getting WA. Here is my solution : https://pastebin.com/NJQMzteQ
Try to solve the problem using AVL trees