結果

問題 No.944 煎っぞ!
ユーザー zer0zer0
提出日時 2020-01-13 18:31:12
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,926 ms / 3,000 ms
コード長 587 bytes
コンパイル時間 137 ms
コンパイル使用メモリ 10,956 KB
実行使用メモリ 38,004 KB
最終ジャッジ日時 2023-08-23 09:15:58
合計ジャッジ時間 20,527 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 899 ms
35,284 KB
testcase_01 AC 456 ms
35,204 KB
testcase_02 AC 327 ms
35,136 KB
testcase_03 AC 379 ms
35,144 KB
testcase_04 AC 1,141 ms
35,236 KB
testcase_05 AC 221 ms
35,152 KB
testcase_06 AC 252 ms
35,212 KB
testcase_07 AC 380 ms
35,264 KB
testcase_08 AC 1,030 ms
35,204 KB
testcase_09 AC 247 ms
35,228 KB
testcase_10 AC 134 ms
29,784 KB
testcase_11 AC 296 ms
31,360 KB
testcase_12 AC 242 ms
30,572 KB
testcase_13 AC 127 ms
29,732 KB
testcase_14 AC 279 ms
31,392 KB
testcase_15 AC 221 ms
30,344 KB
testcase_16 AC 125 ms
29,664 KB
testcase_17 AC 129 ms
29,772 KB
testcase_18 AC 303 ms
31,360 KB
testcase_19 AC 282 ms
31,296 KB
testcase_20 AC 313 ms
37,412 KB
testcase_21 AC 315 ms
37,468 KB
testcase_22 AC 304 ms
34,948 KB
testcase_23 AC 533 ms
34,892 KB
testcase_24 AC 1,332 ms
34,992 KB
testcase_25 AC 366 ms
34,980 KB
testcase_26 AC 357 ms
34,956 KB
testcase_27 AC 1,926 ms
36,920 KB
testcase_28 AC 132 ms
29,772 KB
testcase_29 AC 128 ms
29,636 KB
testcase_30 AC 567 ms
38,004 KB
testcase_31 AC 739 ms
35,028 KB
testcase_32 AC 436 ms
35,020 KB
testcase_33 AC 895 ms
34,876 KB
testcase_34 AC 791 ms
34,880 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np

def div(n):
    rlst = []
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            rlst.append(i)
            if i != n // i:
                rlst.append(n // i)
    rlst.sort()
    return rlst

N = int(input())
a = list(map(int, input().split()))
totala = np.sum(a)
divlst = div(totala)
ruia = [0] * (N + 1)
for i in range(N):
    ruia[i + 1] = a[i] + ruia[i]

ans = 0
for i in divlst:
    tmp = totala // i
    cnt = 0
    for j in ruia[1:]:
        if j % i == 0:
            cnt += 1

    if tmp == cnt:
        ans = max(ans, cnt)

print(ans)
0