26682023-01-18 15:07:18fanibarkaiSíkság (55)python3Wrong answer 0/55300ms35176 KiB
from sys import stdin, stdout
n = int(stdin.readline())
ta = list(map(int, stdin.readline().split()))
ok = (0)
tk = []
for i in range(len(ta)):
    ok += 1
    os = (ok)
    if i != len(ta)-1:
        if ta[i] == ta[i+1]:
            ok += 1
        elif ta[i] - ta[i+1] < 2 and ta[i] != ta[i+1]:
            p = [ta[i],ta[i+1]]
        else:
            ok = 0
            break
    for k in range(i,len(ta)):
        if p.count(ta[k]) == 1:
            os += 1
        else:
            ok = 0
            break
    tk.append([os,i])

for i in range(2):
    stdout.write(str(max(tk)[i])+' ')
    

SubtaskSumTestVerdictTimeMemory
base0/55
1Accepted0/017ms11364 KiB
2Wrong answer0/018ms13832 KiB
3Runtime error0/217ms11696 KiB
4Wrong answer0/217ms12000 KiB
5Runtime error0/217ms12212 KiB
6Runtime error0/217ms12432 KiB
7Runtime error0/317ms12816 KiB
8Runtime error0/217ms13032 KiB
9Runtime error0/317ms13136 KiB
10Runtime error0/318ms15204 KiB
11Runtime error0/318ms14344 KiB
12Runtime error0/318ms14856 KiB
13Wrong answer0/341ms34864 KiB
14Runtime error0/330ms17004 KiB
15Runtime error0/337ms30224 KiB
16Runtime error0/341ms35176 KiB
17Runtime error0/345ms35124 KiB
18Runtime error0/345ms35112 KiB
19Runtime error0/345ms34844 KiB
20Wrong answer0/345ms35108 KiB
21Runtime error0/329ms25224 KiB
22Time limit exceeded0/3300ms14892 KiB