Problem :

https://www.hackerrank.com/challenges/climbing-the-leaderboard/problem


My Solution :

#!/usr/bin/env python3

def climbingLeaderboard(scores, alice):
    scores = sorted(set(scores), reverse=True)
    ret = []
    i, j = len(scores)-1, 0
    while i > -1 and j < len(alice):
        if alice[j] >= scores[i]: i -= 1
        else:
            ret.append(i+2)
            j += 1
    if i == -1: ret += [1]*(len(alice)-j)
    return ret


scores_count = int(input())
scores = list(map(int, input().strip().split()))
alice_count = int(input())
alice = list(map(int, input().strip().split()))
result = climbingLeaderboard(scores, alice)
for rank in result:
    print(rank)