39102023-03-03 22:03:28AndrásSíkság (55)python3Wrong answer 5/55240ms28980 KiB
Lenght = int(input())
Block = input().split()
Min = 0
Max = 0
Len = 0
Place = 0
x = 0
Change = 0
for i in range(len(Block)):
    if x == 0:
        if Change == 1:
            Place = i-Len
        Max = int(Block[i])
        Min = int(Block[i])
        x = x + 2
    else:
        Change = 0
        if int(Block[i]) < Min:
            Min = int(Block[i])
        if int(Block[i]) > Max:
            Max = int(Block[i])
        if int(Block[i]) - Min >= -1 and int(Block[i]) - Min <= 1:
            if int(Block[i]) - Max >= -1 and int(Block[i]) - Max <= 1:
                x = x + 1
            else:
                if x > Len:
                    Len = x
                    Change = 1
                    x = 0
                else:
                    x = 0
        else:
            if x > Len:
                Len = x
                Change = 1
                x = 0
            else:
                x = 0
print(Len,Place)
    
SubtaskSumTestVerdictTimeMemory
base5/55
1Accepted0/017ms11104 KiB
2Wrong answer0/037ms12876 KiB
3Wrong answer0/217ms11716 KiB
4Wrong answer0/217ms11648 KiB
5Wrong answer0/217ms11888 KiB
6Wrong answer0/217ms11764 KiB
7Wrong answer0/317ms12028 KiB
8Accepted2/218ms12712 KiB
9Wrong answer0/319ms12560 KiB
10Wrong answer0/337ms13984 KiB
11Wrong answer0/335ms13560 KiB
12Wrong answer0/337ms14152 KiB
13Time limit exceeded0/3215ms28124 KiB
14Time limit exceeded0/3203ms15348 KiB
15Time limit exceeded0/3219ms24896 KiB
16Time limit exceeded0/3240ms28412 KiB
17Time limit exceeded0/3219ms28644 KiB
18Time limit exceeded0/3216ms28980 KiB
19Time limit exceeded0/3222ms28472 KiB
20Time limit exceeded0/3223ms28760 KiB
21Wrong answer0/3112ms22284 KiB
22Accepted3/3180ms25640 KiB