def main(): n = int(input()) participants = [] flag = True for i in range(n): s, x = input().strip().split() x = int(x) if len(participants) < 10: if s == "TAK": participants.append(i+1) elif len(participants) < 20: if s == "TAK" and x < 2: participants.append(i+1) if len(participants) == 20 and flag: flag = False print(" ".join(map(str, participants))) if __name__ == "__main__": main()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | def main(): n = int(input()) participants = [] flag = True for i in range(n): s, x = input().strip().split() x = int(x) if len(participants) < 10: if s == "TAK": participants.append(i+1) elif len(participants) < 20: if s == "TAK" and x < 2: participants.append(i+1) if len(participants) == 20 and flag: flag = False print(" ".join(map(str, participants))) if __name__ == "__main__": main() |