41122023-03-14 22:49:03kristofLeggyorsabb pénzkeresés (50)python3Wrong answer 2/5075ms36460 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

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

    if eddigi > p:
        eddigi -= arr[bal]
        bal += 1

print(shortest)
SubtaskSumTestVerdictTimeMemory
base2/50
1Wrong answer0/017ms10964 KiB
2Wrong answer0/059ms33788 KiB
3Wrong answer0/217ms11468 KiB
4Wrong answer0/217ms11748 KiB
5Wrong answer0/217ms11608 KiB
6Wrong answer0/227ms13972 KiB
7Wrong answer0/226ms14040 KiB
8Wrong answer0/224ms14116 KiB
9Wrong answer0/224ms13880 KiB
10Wrong answer0/227ms14144 KiB
11Accepted2/257ms34820 KiB
12Wrong answer0/264ms34740 KiB
13Wrong answer0/268ms34780 KiB
14Wrong answer0/261ms35232 KiB
15Wrong answer0/259ms35512 KiB
16Wrong answer0/261ms35408 KiB
17Wrong answer0/265ms35636 KiB
18Wrong answer0/259ms35740 KiB
19Wrong answer0/261ms35788 KiB
20Wrong answer0/268ms35960 KiB
21Wrong answer0/275ms36164 KiB
22Wrong answer0/267ms36460 KiB
23Wrong answer0/263ms36132 KiB
24Wrong answer0/263ms36256 KiB
25Wrong answer0/259ms36204 KiB
26Wrong answer0/259ms36160 KiB
27Wrong answer0/268ms36236 KiB