84112024-01-15 16:34:15birozsHőségriadó (50 pont)python3Accepted 50/50101ms30684 KiB
n,k,l,f = map(int,input().split())
T = list(map(int,input().split()))

#be = open("be2.txt")
#n,k,l,f = map(int,be.readline().split())
#T = list(map(int,be.readline().split()))
#be.close()
riado = False
hoseg = 0
hideg = 0
rendel = 0
for i in range(n):
    if T[i] > f:
        hoseg += 1
        hideg = 0
        if hoseg == k and not(riado):
            riado = True
            rendel += 1
    if T[i] < f:
        hideg += 1
        hoseg = 0
        if riado and hideg == l:
            riado = False
    if T[i] == f:
        hoseg = 0
        hideg = 0
print(rendel)

    
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/018ms11196 KiB
2Accepted0/0101ms27992 KiB
3Accepted2/217ms11800 KiB
4Accepted2/217ms11860 KiB
5Accepted2/217ms12244 KiB
6Accepted2/217ms12284 KiB
7Accepted2/217ms12428 KiB
8Accepted4/419ms12992 KiB
9Accepted4/448ms19688 KiB
10Accepted4/457ms21884 KiB
11Accepted4/468ms23936 KiB
12Accepted4/457ms21712 KiB
13Accepted4/486ms27080 KiB
14Accepted4/424ms14696 KiB
15Accepted4/489ms29876 KiB
16Accepted4/493ms30396 KiB
17Accepted4/493ms30684 KiB