Skip to content

Instantly share code, notes, and snippets.

@ZeronSix
Last active October 25, 2015 15:55
Show Gist options
  • Save ZeronSix/0b4721163b737a869805 to your computer and use it in GitHub Desktop.
Save ZeronSix/0b4721163b737a869805 to your computer and use it in GitHub Desktop.
11.3. Новогодний бал
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