Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- with open('input.txt', 'r', encoding='utf8') as in_f, open('output.txt', 'w') as out_f:
- points = [0] * 301
- maxx = 0
- k = int(in_f.readline())
- for line in in_f:
- line = line.split()
- summ = int(line[-1]) + int(line[-2]) + int(line[-3])
- if int(line[-1]) >= 40 and int(line[-2]) >= 40 and int(line[-3]) >= 40:
- points[summ] += 1
- maxx = max(maxx, summ)
- places = sum(points)
- if points[maxx] > k:
- print(1, file=out_f)
- elif places <= k:
- print(0, file=out_f)
- else:
- i = 300
- ans = 0
- while k > 0:
- k -= points[i]
- if points[i] != 0 and k >= 0:
- ans = i
- i -= 1
- print(ans, file=out_f)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement