Last active
October 25, 2015 15:55
-
-
Save ZeronSix/0b4721163b737a869805 to your computer and use it in GitHub Desktop.
11.3. Новогодний бал
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
with open("input.txt", "r") as fi: | |
n = int(fi.readline()) | |
boys = list(map(int, fi.readline().split(" "))) | |
m = int(fi.readline()) | |
girls = list(map(int, fi.readline().split(" "))) | |
boys.sort() | |
girls.sort() | |
j = m - 1 | |
c = 0 | |
for i in range(n - 1, -1, -1): | |
while j >= 0 and girls[j] > boys[i]: | |
j -= 1 | |
if j < 0: | |
break | |
else: | |
c += 1 | |
j -= 1 | |
with open("output.txt", "w") as fo: | |
fo.write(str(c)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment