180812025-09-27 21:19:17birozsVölgy (100 pont)python3Accepted 100/100185ms7192 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+1]
            j = i + 1
            while j < N-1 and T[j] < T[i]:
                j += 1
                if T[j] > maxv:
                    if j - i > maxszel:
                        maxszel = j - i
                    maxv = T[j]
            if T[j] >= T[i]:
                i = j
            else:
                i += 1
        else:
            i += 1
    print(maxszel)


SubtaskSumTestVerdictTimeMemory
base100/100
1Accepted0/016ms3124 KiB
2Accepted0/017ms3188 KiB
3Accepted5/516ms3116 KiB
4Accepted5/516ms3128 KiB
5Accepted5/517ms3316 KiB
6Accepted5/517ms3360 KiB
7Accepted5/516ms3124 KiB
8Accepted5/516ms3124 KiB
9Accepted5/517ms3124 KiB
10Accepted5/517ms3208 KiB
11Accepted5/523ms3384 KiB
12Accepted5/532ms3152 KiB
13Accepted5/532ms3568 KiB
14Accepted5/535ms3380 KiB
15Accepted5/5179ms7192 KiB
16Accepted5/5165ms7100 KiB
17Accepted5/5158ms6948 KiB
18Accepted5/5185ms6976 KiB
19Accepted5/5171ms7140 KiB
20Accepted5/5168ms7144 KiB
21Accepted5/5172ms6948 KiB
22Accepted5/5180ms7000 KiB