In this problem: https://codeforces.com/contest/1608/problem/C I keep getting WA and I don't know exactly what is wrong with my code

Approach: I make 2 arrays that represent the value of A and the value of B and then sort them according to the value in ascending order. After that, I go through the array A from the end till the beginning and for each i I see if it can beat the biggest A in the second map which is B, and if this is true then this i can win the game. after I finish with array A I do the same thing with array B.