結果

問題 No.944 煎っぞ!
ユーザー prd_xxxprd_xxx
提出日時 2019-12-07 00:14:33
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 932 ms / 3,000 ms
コード長 433 bytes
コンパイル時間 91 ms
コンパイル使用メモリ 10,836 KB
実行使用メモリ 16,052 KB
最終ジャッジ日時 2023-08-25 18:33:32
合計ジャッジ時間 5,571 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 93 ms
10,680 KB
testcase_01 AC 68 ms
10,544 KB
testcase_02 AC 80 ms
10,608 KB
testcase_03 AC 81 ms
10,620 KB
testcase_04 AC 111 ms
10,600 KB
testcase_05 AC 59 ms
10,592 KB
testcase_06 AC 75 ms
10,640 KB
testcase_07 AC 86 ms
10,560 KB
testcase_08 AC 109 ms
10,632 KB
testcase_09 AC 58 ms
10,612 KB
testcase_10 AC 15 ms
7,960 KB
testcase_11 AC 45 ms
9,700 KB
testcase_12 AC 31 ms
9,052 KB
testcase_13 AC 15 ms
7,956 KB
testcase_14 AC 30 ms
9,680 KB
testcase_15 AC 32 ms
8,904 KB
testcase_16 AC 14 ms
7,832 KB
testcase_17 AC 14 ms
7,956 KB
testcase_18 AC 44 ms
9,688 KB
testcase_19 AC 44 ms
9,656 KB
testcase_20 AC 68 ms
15,528 KB
testcase_21 AC 73 ms
15,512 KB
testcase_22 AC 91 ms
9,948 KB
testcase_23 AC 123 ms
10,028 KB
testcase_24 AC 155 ms
10,032 KB
testcase_25 AC 111 ms
10,056 KB
testcase_26 AC 112 ms
9,964 KB
testcase_27 AC 269 ms
15,256 KB
testcase_28 AC 15 ms
7,896 KB
testcase_29 AC 15 ms
7,900 KB
testcase_30 AC 94 ms
16,052 KB
testcase_31 AC 932 ms
9,984 KB
testcase_32 AC 395 ms
9,988 KB
testcase_33 AC 186 ms
12,708 KB
testcase_34 AC 185 ms
12,628 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int,input().split()))
sa = sum(A)

ds = set()
d = 1
while d*d <= sa:
    if sa%d==0:
        ds.add(d)
        ds.add(sa//d)
    d += 1

ans = 1
for d in ds:
    if d > N: continue
    v = sa//d
    c = 0
    nxt = v
    for a in A:
        if c+a > nxt: break
        if c+a == nxt:
            c += a
            nxt += v
        else:
            c += a
    else:
        ans = max(ans, d)
print(ans)
0