41592023-03-15 16:40:14kristofLeggyorsabb pénzkeresés (50)python3Wrong answer 2/50148ms36692 KiB
n, p = map(int, input().split())
arr = list(map(int, input().split()))

eddigi = 0
bal = 0
jobb = 0
eddigi = arr[0]
shortest=n+1

while jobb < n:
    if eddigi <= p:
        eddigi += arr[jobb]
        jobb += 1
        shortest = min(jobb-bal+1, shortest)

    if shortest < jobb-bal+1:
        eddigi -= arr[bal]
        bal += 1

print(shortest)
SubtaskSumTestVerdictTimeMemory
base2/50
1Wrong answer0/017ms10992 KiB
2Wrong answer0/0148ms33864 KiB
3Wrong answer0/217ms11724 KiB
4Wrong answer0/217ms11880 KiB
5Wrong answer0/217ms11756 KiB
6Wrong answer0/229ms14172 KiB
7Wrong answer0/229ms14524 KiB
8Wrong answer0/228ms14760 KiB
9Wrong answer0/229ms14988 KiB
10Wrong answer0/228ms14992 KiB
11Accepted2/2137ms35424 KiB
12Wrong answer0/2146ms35524 KiB
13Wrong answer0/2141ms35748 KiB
14Wrong answer0/2136ms35624 KiB
15Wrong answer0/2136ms35876 KiB
16Wrong answer0/2148ms35712 KiB
17Wrong answer0/2143ms35992 KiB
18Wrong answer0/2136ms36312 KiB
19Wrong answer0/2143ms36244 KiB
20Wrong answer0/2143ms36372 KiB
21Wrong answer0/2142ms36248 KiB
22Wrong answer0/2141ms36556 KiB
23Wrong answer0/2138ms36508 KiB
24Wrong answer0/2144ms36456 KiB
25Wrong answer0/2137ms36520 KiB
26Wrong answer0/2141ms36572 KiB
27Wrong answer0/2145ms36692 KiB