結果

問題 No.944 煎っぞ!
ユーザー tails1434tails1434
提出日時 2020-01-02 08:41:09
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 121 ms / 3,000 ms
コード長 827 bytes
コンパイル時間 139 ms
コンパイル使用メモリ 81,840 KB
実行使用メモリ 94,720 KB
最終ジャッジ日時 2024-05-02 06:12:01
合計ジャッジ時間 3,775 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
87,808 KB
testcase_01 AC 67 ms
87,424 KB
testcase_02 AC 67 ms
87,424 KB
testcase_03 AC 65 ms
87,552 KB
testcase_04 AC 66 ms
88,192 KB
testcase_05 AC 66 ms
87,680 KB
testcase_06 AC 69 ms
87,532 KB
testcase_07 AC 65 ms
87,680 KB
testcase_08 AC 66 ms
87,808 KB
testcase_09 AC 66 ms
87,936 KB
testcase_10 AC 43 ms
59,904 KB
testcase_11 AC 47 ms
65,792 KB
testcase_12 AC 46 ms
62,336 KB
testcase_13 AC 38 ms
52,480 KB
testcase_14 AC 48 ms
65,408 KB
testcase_15 AC 46 ms
61,952 KB
testcase_16 AC 38 ms
52,456 KB
testcase_17 AC 37 ms
52,096 KB
testcase_18 AC 47 ms
65,856 KB
testcase_19 AC 46 ms
64,768 KB
testcase_20 AC 67 ms
88,832 KB
testcase_21 AC 68 ms
88,448 KB
testcase_22 AC 69 ms
87,680 KB
testcase_23 AC 67 ms
88,024 KB
testcase_24 AC 69 ms
87,936 KB
testcase_25 AC 65 ms
87,680 KB
testcase_26 AC 67 ms
87,480 KB
testcase_27 AC 71 ms
88,704 KB
testcase_28 AC 38 ms
52,480 KB
testcase_29 AC 39 ms
52,352 KB
testcase_30 AC 69 ms
88,960 KB
testcase_31 AC 121 ms
94,720 KB
testcase_32 AC 73 ms
91,136 KB
testcase_33 AC 71 ms
89,876 KB
testcase_34 AC 73 ms
89,984 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import accumulate

def division(n):
    ass = []
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            ass.append(i)
            if i * i == n:
                continue
            ass.append(n // i)

    return ass

def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = [0] + list(accumulate(A))
    sumA = sum(A)
    div = division(sumA)
    ans = 0
    for n in div:
        index = 0
        flag = True
        cnt = 0
        for i in range(N + 1):
            if B[i] - B[index] == n:
                index = i
                cnt += 1
            elif B[i] - B[index] < n:
                continue
            else:
                break
        if cnt * n == sumA:
            ans = max(ans, cnt)

    print(ans)



if __name__ == "__main__":
    main()
0