結果

問題 No.944 煎っぞ!
ユーザー rlangevinrlangevin
提出日時 2023-01-12 12:39:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 110 ms / 3,000 ms
コード長 479 bytes
コンパイル時間 1,842 ms
コンパイル使用メモリ 86,904 KB
実行使用メモリ 104,488 KB
最終ジャッジ日時 2023-08-24 20:25:06
合計ジャッジ時間 5,443 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 105 ms
104,184 KB
testcase_01 AC 105 ms
103,936 KB
testcase_02 AC 106 ms
104,064 KB
testcase_03 AC 103 ms
104,244 KB
testcase_04 AC 104 ms
104,140 KB
testcase_05 AC 103 ms
104,184 KB
testcase_06 AC 105 ms
103,956 KB
testcase_07 AC 104 ms
104,080 KB
testcase_08 AC 104 ms
104,060 KB
testcase_09 AC 104 ms
104,004 KB
testcase_10 AC 75 ms
76,140 KB
testcase_11 AC 78 ms
79,268 KB
testcase_12 AC 76 ms
76,580 KB
testcase_13 AC 71 ms
71,308 KB
testcase_14 AC 80 ms
79,496 KB
testcase_15 AC 76 ms
76,400 KB
testcase_16 AC 72 ms
71,352 KB
testcase_17 AC 72 ms
71,428 KB
testcase_18 AC 81 ms
79,572 KB
testcase_19 AC 81 ms
78,896 KB
testcase_20 AC 107 ms
104,488 KB
testcase_21 AC 108 ms
104,452 KB
testcase_22 AC 103 ms
104,024 KB
testcase_23 AC 104 ms
104,272 KB
testcase_24 AC 104 ms
104,032 KB
testcase_25 AC 105 ms
104,052 KB
testcase_26 AC 104 ms
103,972 KB
testcase_27 AC 105 ms
104,156 KB
testcase_28 AC 71 ms
71,252 KB
testcase_29 AC 72 ms
71,564 KB
testcase_30 AC 106 ms
104,384 KB
testcase_31 AC 110 ms
104,112 KB
testcase_32 AC 106 ms
104,228 KB
testcase_33 AC 108 ms
104,288 KB
testcase_34 AC 108 ms
104,416 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def div(n):
    i = 1
    SS = set()
    while i * i <= n:
        if n % i == 0:
            SS.add(i)
            SS.add(n//i)
        i += 1
    return SS    


N = int(input())
A = list(map(int, input().split()))
Ac = [0] * (N + 1)
for i in range(N):
    Ac[i + 1] = Ac[i] + A[i]
S = set(Ac)
ans = 0
M = Ac[-1]
for d in div(M):
    now = d
    for v in range(M//d):
        if now not in S:
            break
        now += d
    else:
        ans = max(ans, M//d)
print(ans)
0