112882024-08-03 23:03:17probaElőzésekpython3Runtime error 0/10079ms26380 KiB
# előzések
sor1 = list(map(int, input().split(' '))); N = sor1[0]; elozes = sor1[1]

C = list(map(int, input().split(' ')))

f = []
for i in range(elozes):
    f += [int(input())]

#f = list(map(int, '1 1 1 4 3 7 4 6'.split(' ')))

n = [0]*N

for i in range(elozes):
    ki = C.index(f[i]); kit = C[ki-1]
    #print(C, f[i], kit, n.index(m)+1)
    C[ki-1], C[ki] = C[ki], C[ki-1]
    n[kit-1] += 1; m = max(n)
    print(n.index(m)+1)
    
#print(C)    
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted17ms3044 KiB
subtask20/30
2Runtime error17ms3048 KiB
3Runtime error17ms3044 KiB
4Runtime error18ms3088 KiB
5Runtime error18ms3244 KiB
6Runtime error17ms3216 KiB
7Runtime error17ms3120 KiB
subtask30/70
8Runtime error28ms6608 KiB
9Runtime error37ms10956 KiB
10Runtime error41ms12596 KiB
11Runtime error54ms17820 KiB
12Runtime error57ms18936 KiB
13Runtime error59ms20312 KiB
14Runtime error75ms24660 KiB
15Runtime error74ms26360 KiB
16Runtime error74ms26228 KiB
17Runtime error79ms26248 KiB
18Runtime error72ms26228 KiB
19Runtime error74ms26376 KiB
20Runtime error70ms24652 KiB
21Runtime error78ms26380 KiB