115822024-10-27 14:01:17balintFelhasználónevekpython3Runtime error 20/100372ms23748 KiB
def main():
    username = input()
    length = len(username)
    nums = set()   
    default_taken = False
    for _ in range(int(input())):
        if (name:= input())[:length] == username:
            if len(name) == len(username):
                default_taken = True
            else:
                nums.add(int(name[length:]))
                
    if not default_taken:
        print(username)
        return
    i = 1
    while True:
        if i not in nums:
            print(username + str(i))
            return
        i+= 1
main()
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted16ms3064 KiB
2Accepted16ms3128 KiB
subtask220/20
3Accepted14ms3056 KiB
4Accepted16ms3128 KiB
subtask30/40
5Accepted17ms3128 KiB
6Accepted14ms3132 KiB
7Accepted16ms3124 KiB
8Accepted16ms3128 KiB
9Accepted16ms3344 KiB
10Accepted17ms3128 KiB
11Accepted16ms3128 KiB
12Accepted16ms3060 KiB
13Runtime error16ms3104 KiB
14Runtime error14ms3136 KiB
subtask40/40
15Accepted328ms23728 KiB
16Accepted335ms23716 KiB
17Accepted330ms23748 KiB
18Accepted349ms23720 KiB
19Accepted361ms23720 KiB
20Accepted349ms23720 KiB
21Accepted372ms23744 KiB
22Accepted363ms23484 KiB
23Runtime error16ms3148 KiB
24Runtime error16ms3132 KiB
25Runtime error17ms2960 KiB
26Runtime error17ms3132 KiB
27Accepted321ms23624 KiB