112992024-08-04 22:33:45probaLeghosszabb nyaralás (75 pont)python3Time limit exceeded 25/75300ms13840 KiB
#nyaralás
#sor1 = '8 10'; sor2 = '3 6 4 2 3 7 2 9'
sor1 = input(); sor2 = input()

l1 = list(map(int, sor1.split(' ')))
N, m = l1[0], l1[1]
nap = list(map(int, sor2.split(' ')))

hossz = 1
for i in range(N):
    d = hossz
    while i+d < N and sum(nap[i:i+d+1]) <= m:
        d += 1
    if d > hossz:
        hossz = d
        
print(hossz)        
SubtaskSumTestVerdictTimeMemory
base25/75
1Accepted0/017ms2988 KiB
2Time limit exceeded0/0296ms13840 KiB
3Accepted3/317ms2916 KiB
4Accepted3/317ms2916 KiB
5Accepted3/317ms2864 KiB
6Accepted3/317ms2916 KiB
7Wrong answer0/317ms2936 KiB
8Accepted4/417ms2916 KiB
9Accepted4/418ms2924 KiB
10Accepted5/520ms3064 KiB
11Time limit exceeded0/5296ms3832 KiB
12Time limit exceeded0/5211ms4068 KiB
13Time limit exceeded0/7298ms5672 KiB
14Time limit exceeded0/7298ms10168 KiB
15Time limit exceeded0/7298ms13540 KiB
16Time limit exceeded0/8300ms11068 KiB
17Time limit exceeded0/8298ms13796 KiB