117492024-11-09 00:42:59balintKövek (100 pont)python3Time limit exceeded 10/100300ms15280 KiB
from math import ceil


def main():
    n = int(input())

    nums = list(map(int, input().split()))
    good_num = sum(nums) // n
    corrected_amount = 0
    returning = 0
    for hossz in range(2, n):
        i = 0
        while hossz + i <= n:
            if sum(nums[i : i + hossz]) == good_num * hossz:
                corrected_amount += hossz
                returning += ceil(hossz / 2)
            if corrected_amount == n:
                print(returning)
                return
            i += 1


main()
SubtaskSumTestVerdictTimeMemory
base10/100
1Accepted0/016ms3128 KiB
2Time limit exceeded0/0280ms15264 KiB
3Wrong answer0/516ms3144 KiB
4Wrong answer0/516ms3116 KiB
5Wrong answer0/517ms3128 KiB
6Wrong answer0/516ms3128 KiB
7Accepted5/517ms3128 KiB
8Accepted5/516ms3128 KiB
9Wrong answer0/716ms3320 KiB
10Wrong answer0/718ms3116 KiB
11Wrong answer0/835ms3132 KiB
12Time limit exceeded0/8250ms3128 KiB
13Time limit exceeded0/8300ms3384 KiB
14Time limit exceeded0/8284ms3896 KiB
15Time limit exceeded0/8289ms6336 KiB
16Time limit exceeded0/8208ms13792 KiB
17Time limit exceeded0/8298ms15280 KiB