39122023-03-03 22:49:27AndrásSíkság (55)python3Wrong answer 0/55282ms15224 KiB
Lenght = int(input())
Block = input().split()
Min = 0
Max = 0
Place = 0
Len = 0
x = 1
Change = 0
for i in range(len(Block)):
    if Min == 0 and Max == 0:
        Min = int(Block[i])
        Max = int(Block[i])
        print("Min =",Min,"Max =",Max,"Block[i] =",Block[i])
        print("x =",x)
    else:
        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 and int(Block[i]) - Max >= -1 and int(Block[i]) - Max <= 1:
            x = x + 1
            print("Min =",Min,"Max =",Max,"Block[i] =",Block[i])
            print("x =",x)
        else:
            if x > Len:
                Len = x
                Place = i - Len + 1
                x = 1
                print("Min =",Min,"Max =",Max,"Block[i] =",Block[i])
                print("x =",x)
                Min = int(Block[i+1])
                Max = int(Block[i+1])
            else:
                x = 1
                print("Min =",Min,"Max =",Max,"Block[i] =",Block[i])
                print("x =",x)
                Min = int(Block[i+1])
                Max = int(Block[i+1])
print(Len,Place)
            
SubtaskSumTestVerdictTimeMemory
base0/55
1Wrong answer0/017ms11424 KiB
2Runtime error0/064ms13112 KiB
3Wrong answer0/217ms11632 KiB
4Runtime error0/217ms12056 KiB
5Runtime error0/217ms12316 KiB
6Wrong answer0/217ms12424 KiB
7Wrong answer0/317ms12580 KiB
8Wrong answer0/223ms12896 KiB
9Wrong answer0/323ms13584 KiB
10Wrong answer0/364ms14872 KiB
11Wrong answer0/364ms14256 KiB
12Wrong answer0/364ms15224 KiB
13Time limit exceeded0/3231ms13384 KiB
14Time limit exceeded0/3282ms7012 KiB
15Time limit exceeded0/3250ms11904 KiB
16Time limit exceeded0/3259ms13992 KiB
17Time limit exceeded0/3256ms14004 KiB
18Time limit exceeded0/3275ms14128 KiB
19Time limit exceeded0/3280ms13940 KiB
20Time limit exceeded0/3264ms13796 KiB
21Time limit exceeded0/3241ms10508 KiB
22Time limit exceeded0/3275ms13180 KiB