112972024-08-04 17:37:11probaLeghosszabb nyaralás (75 pont)python3Time limit exceeded 28/75300ms14228 KiB
#sor1 = '8 10'; sor2 = '3 6 4 2 3 7 2 9'
sor1 = input(); sor2 = input()

l = list(map(int, sor1.split(' '))); N = l[0]; hatar = l[1]
ar = list(map(int, sor2.split(' ')))

hossz = 0
for i in range(N):
    j, ossz = 0, 0
    while i+j < N and ossz+ar[i+j] <= hatar:
        ossz += ar[i+j]
        j += 1
    if j > hossz:
        hossz = j

print(hossz)
        
SubtaskSumTestVerdictTimeMemory
base28/75
1Accepted0/018ms3044 KiB
2Time limit exceeded0/0291ms14228 KiB
3Accepted3/317ms2972 KiB
4Accepted3/317ms2980 KiB
5Accepted3/317ms2920 KiB
6Accepted3/317ms3044 KiB
7Accepted3/317ms2916 KiB
8Accepted4/420ms3064 KiB
9Accepted4/470ms2920 KiB
10Accepted5/5172ms3044 KiB
11Time limit exceeded0/5298ms3812 KiB
12Time limit exceeded0/5298ms4088 KiB
13Time limit exceeded0/7300ms5652 KiB
14Time limit exceeded0/7291ms10680 KiB
15Time limit exceeded0/7298ms14056 KiB
16Time limit exceeded0/8296ms11708 KiB
17Time limit exceeded0/8298ms14188 KiB