117332024-11-08 13:44:47balintLeggyorsabb pénzkeresés (50)python3Time limit exceeded 8/50300ms14676 KiB
def main():
    N, P = map(int, input().split())
    nums = list(map(int, input().split()))
    minimal_length = N

    for i in range(N - 1):
        suma = 0
        for j in range(i, N):
            suma += nums[j]
            if suma >= P:
                jmip1 = j - i + 1
                if jmip1 < minimal_length:
                    minimal_length = jmip1
                break
    print(minimal_length)


main()
SubtaskSumTestVerdictTimeMemory
base8/50
1Accepted0/014ms2872 KiB
2Time limit exceeded0/0287ms14616 KiB
3Accepted2/216ms3124 KiB
4Accepted2/217ms3124 KiB
5Accepted2/217ms3096 KiB
6Time limit exceeded0/2237ms4104 KiB
7Time limit exceeded0/2300ms4024 KiB
8Time limit exceeded0/2300ms4024 KiB
9Time limit exceeded0/2212ms4152 KiB
10Time limit exceeded0/2300ms3996 KiB
11Accepted2/2107ms14676 KiB
12Time limit exceeded0/2300ms14544 KiB
13Time limit exceeded0/2287ms14616 KiB
14Time limit exceeded0/2277ms14616 KiB
15Time limit exceeded0/2286ms14612 KiB
16Time limit exceeded0/2282ms14616 KiB
17Time limit exceeded0/2289ms14616 KiB
18Time limit exceeded0/2287ms14612 KiB
19Time limit exceeded0/2282ms14616 KiB
20Time limit exceeded0/2293ms14612 KiB
21Time limit exceeded0/2291ms14616 KiB
22Time limit exceeded0/2300ms14616 KiB
23Time limit exceeded0/2277ms14616 KiB
24Time limit exceeded0/2282ms14512 KiB
25Time limit exceeded0/2282ms14616 KiB
26Time limit exceeded0/2300ms14616 KiB
27Time limit exceeded0/2286ms14620 KiB