# Author: Bartek Knapik
n = int(input())
finalists = [None for _ in range(n)]
for i in range(n):
yn, cnt = input().split()
yn = True if yn == 'TAK' else False
cnt = int(cnt)
finalists[i] = (yn, cnt)
top10 = 10
bottom10 = 10
pos = 1
ans = []
while top10:
candidate = finalists.pop(0)
if candidate[0]:
top10 -= 1
ans.append(pos)
pos += 1
while bottom10:
candidate = finalists.pop(0)
if candidate[0] and candidate[1] < 2:
bottom10 -= 1
ans.append(pos)
pos += 1
print(" ".join(str(el) for el in ans))
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | # Author: Bartek Knapik n = int(input()) finalists = [None for _ in range(n)] for i in range(n): yn, cnt = input().split() yn = True if yn == 'TAK' else False cnt = int(cnt) finalists[i] = (yn, cnt) top10 = 10 bottom10 = 10 pos = 1 ans = [] while top10: candidate = finalists.pop(0) if candidate[0]: top10 -= 1 ans.append(pos) pos += 1 while bottom10: candidate = finalists.pop(0) if candidate[0] and candidate[1] < 2: bottom10 -= 1 ans.append(pos) pos += 1 print(" ".join(str(el) for el in ans)) |
English