Last active
July 1, 2018 10:12
-
-
Save khrlimam/6bee326fd051ff2beb5092367983f112 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bisect | |
n = int(input('')) | |
n_scores = input('') | |
n_scores = map(int, n_scores.split()) | |
m = int(input('')) | |
m_scores = input('') | |
m_scores = map(int, m_scores.split()) | |
sort_unduplicate_scores = sorted(set(n_scores)) | |
for alice_score in m_scores: | |
# get to know in what index/position is alice score if it's | |
# compared to our sorted unduplicate leaderboard score | |
index = bisect.bisect(sort_unduplicate_scores, alice_score) | |
# then we count that position from right since our first score is | |
# began from right. In order to do that we just need to count | |
# the difference between position of the most right score and | |
# our compared alice score, then we need to add it with 1 | |
# since difference only count the length between 2 point | |
# without including the first start position. | |
position = len(sort_unduplicate_scores)-index+1 | |
print(position) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment