84842024-01-17 15:43:42petergalambosHőségriadó (50 pont)python3Accepted 50/5068ms30900 KiB
def main():
    from sys import stdin
    N, K, L, F = [int(i) for i in input().split()]
    A = [int(i) for i in stdin.readline().split()]

    M = 0
    H = 0
    riado = False
    S = 0
    for a in A:
        if a > F:
            M += 1
            H = 0
            if M >= K and not riado:
                riado = True
                S += 1
        elif a < F:
            H += 1
            M = 0
            if H >= L and riado:
                riado = False
        if a == F:
            H = 0
            M = 0
    print(S)
main()
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/017ms11200 KiB
2Accepted0/068ms28136 KiB
3Accepted2/218ms11912 KiB
4Accepted2/217ms11676 KiB
5Accepted2/217ms11812 KiB
6Accepted2/218ms11852 KiB
7Accepted2/217ms12516 KiB
8Accepted4/419ms12736 KiB
9Accepted4/437ms19316 KiB
10Accepted4/443ms21612 KiB
11Accepted4/448ms23844 KiB
12Accepted4/441ms21876 KiB
13Accepted4/459ms27420 KiB
14Accepted4/421ms14912 KiB
15Accepted4/465ms30084 KiB
16Accepted4/467ms30640 KiB
17Accepted4/464ms30900 KiB