7272021-12-21 14:09:02kismartongKéséspython3Time limit exceeded 10/50597ms33452 KiB
from sys import stdin, stdout

def main():
    n = int(stdin.readline())
    sz = list(map(int, stdin.readline().split()))
    megnezve = []
    mini = n-1
    ford = list(reversed(sz))
    for i in sz:
        if i not in megnezve:
            if n - ford.index(i)-1 < mini:
                mini = n - ford.index(i)-1
            megnezve.append(i)
    stdout.writelines(str(mini+1))

main()
SubtaskSumTestVerdictTimeMemory
base10/50
1Accepted0/045ms13016 KiB
2Time limit exceeded0/0540ms6764 KiB
3Accepted5/552ms13348 KiB
4Accepted5/556ms13428 KiB
5Time limit exceeded0/5507ms26212 KiB
6Time limit exceeded0/5531ms26976 KiB
7Time limit exceeded0/4545ms29360 KiB
8Time limit exceeded0/4575ms30508 KiB
9Time limit exceeded0/4592ms31664 KiB
10Time limit exceeded0/4584ms32988 KiB
11Time limit exceeded0/4554ms32944 KiB
12Time limit exceeded0/2597ms33420 KiB
13Time limit exceeded0/2595ms33400 KiB
14Time limit exceeded0/1569ms33396 KiB
15Time limit exceeded0/1597ms33424 KiB
16Time limit exceeded0/1579ms33452 KiB
17Time limit exceeded0/1589ms33388 KiB
18Time limit exceeded0/1597ms33448 KiB
19Time limit exceeded0/1595ms33348 KiB