結果

問題 No.944 煎っぞ!
ユーザー convexineqconvexineq
提出日時 2021-05-06 04:48:15
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 111 ms / 3,000 ms
コード長 520 bytes
コンパイル時間 372 ms
コンパイル使用メモリ 87,028 KB
実行使用メモリ 91,328 KB
最終ジャッジ日時 2023-10-11 22:03:59
合計ジャッジ時間 5,087 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 96 ms
90,876 KB
testcase_01 AC 97 ms
91,172 KB
testcase_02 AC 98 ms
91,120 KB
testcase_03 AC 98 ms
91,328 KB
testcase_04 AC 98 ms
91,036 KB
testcase_05 AC 97 ms
91,244 KB
testcase_06 AC 97 ms
91,180 KB
testcase_07 AC 98 ms
90,932 KB
testcase_08 AC 98 ms
91,204 KB
testcase_09 AC 96 ms
90,976 KB
testcase_10 AC 80 ms
76,156 KB
testcase_11 AC 83 ms
77,356 KB
testcase_12 AC 78 ms
76,052 KB
testcase_13 AC 74 ms
71,288 KB
testcase_14 AC 81 ms
77,528 KB
testcase_15 AC 78 ms
76,080 KB
testcase_16 AC 74 ms
71,296 KB
testcase_17 AC 73 ms
71,268 KB
testcase_18 AC 84 ms
77,576 KB
testcase_19 AC 81 ms
77,368 KB
testcase_20 AC 100 ms
91,204 KB
testcase_21 AC 98 ms
91,324 KB
testcase_22 AC 99 ms
91,144 KB
testcase_23 AC 96 ms
91,276 KB
testcase_24 AC 98 ms
90,928 KB
testcase_25 AC 98 ms
91,192 KB
testcase_26 AC 97 ms
91,080 KB
testcase_27 AC 103 ms
90,992 KB
testcase_28 AC 76 ms
71,460 KB
testcase_29 AC 73 ms
71,376 KB
testcase_30 AC 100 ms
91,152 KB
testcase_31 AC 111 ms
91,112 KB
testcase_32 AC 102 ms
90,916 KB
testcase_33 AC 103 ms
91,184 KB
testcase_34 AC 102 ms
91,068 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def divisor_list(N): #約数のリスト
    if N == 1: return [1]
    res = []
    for i in range(1,N):
        if i*i >= N: break
        if N%i == 0:
            res.append(i)
            res.append(N//i)
    if i*i == N: res.append(i)
    return sorted(res)

def check(x):
    v = 0
    for ai in a:
        if v+ai > x: return 0
        v += ai
        if v == x: v = 0
    return 1

n = int(input())
*a, = map(int,input().split())
s = sum(a)
ans = 0
for d in divisor_list(s):
    if check(s//d): ans = d
print(ans)
0