85282024-01-21 14:15:18NagyLeoLeggyorsabb pénzkeresés (50)python3Time limit exceeded 8/50287ms36624 KiB
from sys import stdin, stdout


def main():
    NP = list(stdin.readline().split())
    N = int(NP[0])
    P = int(NP[1])
    smallest = N+1

    days = list(map(int, stdin.readline().split()))
    for i in range(0, len(days)):
        current = 0
        countr = 0
        for f in range(i, len(days)):
            countr += 1
            current += days[f]
            if current >= P:
                if countr < smallest:
                    smallest = countr
                break

    stdout.write(str(smallest))


main()
SubtaskSumTestVerdictTimeMemory
base8/50
1Accepted0/017ms11176 KiB
2Time limit exceeded0/0229ms15732 KiB
3Accepted2/217ms12100 KiB
4Accepted2/217ms12328 KiB
5Accepted2/218ms12396 KiB
6Time limit exceeded0/2268ms6536 KiB
7Time limit exceeded0/2259ms6584 KiB
8Time limit exceeded0/2272ms6788 KiB
9Time limit exceeded0/2252ms7040 KiB
10Time limit exceeded0/2268ms7048 KiB
11Accepted2/2157ms36624 KiB
12Time limit exceeded0/2259ms18552 KiB
13Time limit exceeded0/2270ms19040 KiB
14Time limit exceeded0/2268ms19764 KiB
15Time limit exceeded0/2272ms20172 KiB
16Time limit exceeded0/2268ms20960 KiB
17Time limit exceeded0/2259ms21552 KiB
18Time limit exceeded0/2266ms21756 KiB
19Time limit exceeded0/2279ms22612 KiB
20Time limit exceeded0/2279ms23068 KiB
21Time limit exceeded0/2287ms23620 KiB
22Time limit exceeded0/2275ms24296 KiB
23Time limit exceeded0/2280ms24548 KiB
24Time limit exceeded0/2268ms25304 KiB
25Time limit exceeded0/2275ms25876 KiB
26Time limit exceeded0/2279ms26344 KiB
27Time limit exceeded0/2238ms26764 KiB