117302024-11-08 12:53:22balintLeggyorsabb pénzkeresés (50)python3Time limit exceeded 4/50289ms15132 KiB
def main():
    N, P = map(int, input().split())
    nums = list(map(int, input().split()))
    for n in range(1, N + 1):
        i = 0
        while i + n <= N:
            if sum(nums[i : i + n]) == P:
                print(n)
                return
            i += 1


main()
SubtaskSumTestVerdictTimeMemory
base4/50
1Accepted0/016ms2880 KiB
2Time limit exceeded0/0275ms15132 KiB
3Wrong answer0/217ms3108 KiB
4Accepted2/217ms3056 KiB
5Wrong answer0/217ms2872 KiB
6Time limit exceeded0/2277ms4156 KiB
7Time limit exceeded0/2277ms4152 KiB
8Time limit exceeded0/2284ms4152 KiB
9Time limit exceeded0/2284ms4152 KiB
10Time limit exceeded0/2287ms4152 KiB
11Accepted2/289ms15132 KiB
12Time limit exceeded0/2282ms15132 KiB
13Time limit exceeded0/2284ms14936 KiB
14Time limit exceeded0/2277ms15132 KiB
15Time limit exceeded0/2277ms15132 KiB
16Time limit exceeded0/2289ms15132 KiB
17Time limit exceeded0/2277ms14968 KiB
18Time limit exceeded0/2280ms15132 KiB
19Time limit exceeded0/2282ms15132 KiB
20Time limit exceeded0/2279ms14936 KiB
21Time limit exceeded0/2289ms15132 KiB
22Time limit exceeded0/2287ms15132 KiB
23Time limit exceeded0/2286ms15132 KiB
24Time limit exceeded0/2284ms15132 KiB
25Time limit exceeded0/2284ms15132 KiB
26Time limit exceeded0/2286ms15132 KiB
27Time limit exceeded0/2287ms15120 KiB