246872026-02-13 16:29:13csicsilla70Völgy (100 pont)python3Wrong answer 80/100172ms7064 KiB
N = int(input())
maxszel = 0
T = []
for i in range(N):
    T.append(int(input()))
tores = False
for i in range(1,N):
    if T[i] > T[i-1]:
        tores = True
        break
if not tores:
    print(-1)
else:
    maxszel = -1
    i = 0
    while i < N-2 and i + maxszel < N:
        if T[i] > T[i+1]:
            maxv = T[i]
            j = i + 1
            while j < N-1 and T[j] < maxv:
                j += 1
                if T[j] >= maxv:
                    if j - i > maxszel:
                        maxszel = j - i
                    maxv = T[j]
            if T[j] >= maxv:
                i = j
            else:
                i += 1
        else:
            i += 1
    print(maxszel)
SubtaskSumTestVerdictTimeMemory
base80/100
1Accepted0/016ms3312 KiB
2Wrong answer0/017ms3124 KiB
3Accepted5/516ms3124 KiB
4Accepted5/516ms3120 KiB
5Wrong answer0/516ms3124 KiB
6Wrong answer0/516ms3172 KiB
7Accepted5/516ms3124 KiB
8Accepted5/514ms3084 KiB
9Accepted5/517ms3004 KiB
10Wrong answer0/517ms3112 KiB
11Accepted5/524ms3352 KiB
12Accepted5/532ms3068 KiB
13Accepted5/530ms3440 KiB
14Wrong answer0/537ms3456 KiB
15Accepted5/5172ms7064 KiB
16Accepted5/5160ms6980 KiB
17Accepted5/5164ms6948 KiB
18Accepted5/5171ms6948 KiB
19Accepted5/5167ms6948 KiB
20Accepted5/5170ms6952 KiB
21Accepted5/5171ms6948 KiB
22Accepted5/5172ms7008 KiB