• + 1 comment

    timeout in last four test cases. in my python code. i don't know what is wrong. can any one help me?

    #!/bin/python
    import sys
    g = int(raw_input().strip())
    for a0 in xrange(g):
        n = int(raw_input().strip())
        A = [int(e) for e in raw_input().split()]
        res = 0
        while len(A)>0:
            A = A[:A.index(max(A))]
            res += 1
        if res%2 == 0:
            print "ANDY"
        else:
            print "BOB"