結果

問題 No.944 煎っぞ!
ユーザー ああいいああいい
提出日時 2022-03-13 22:33:23
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 78 ms / 3,000 ms
コード長 570 bytes
コンパイル時間 179 ms
コンパイル使用メモリ 81,652 KB
実行使用メモリ 84,908 KB
最終ジャッジ日時 2023-10-19 09:59:00
合計ジャッジ時間 3,391 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 61 ms
78,680 KB
testcase_01 AC 62 ms
78,680 KB
testcase_02 AC 61 ms
78,680 KB
testcase_03 AC 61 ms
78,680 KB
testcase_04 AC 61 ms
78,680 KB
testcase_05 AC 60 ms
78,532 KB
testcase_06 AC 61 ms
78,680 KB
testcase_07 AC 61 ms
78,680 KB
testcase_08 AC 62 ms
78,680 KB
testcase_09 AC 60 ms
78,680 KB
testcase_10 AC 46 ms
59,836 KB
testcase_11 AC 49 ms
64,848 KB
testcase_12 AC 47 ms
61,884 KB
testcase_13 AC 38 ms
53,444 KB
testcase_14 AC 48 ms
64,852 KB
testcase_15 AC 47 ms
61,884 KB
testcase_16 AC 39 ms
53,444 KB
testcase_17 AC 38 ms
53,444 KB
testcase_18 AC 48 ms
64,852 KB
testcase_19 AC 47 ms
64,516 KB
testcase_20 AC 62 ms
79,068 KB
testcase_21 AC 63 ms
79,068 KB
testcase_22 AC 61 ms
78,660 KB
testcase_23 AC 62 ms
78,660 KB
testcase_24 AC 62 ms
78,660 KB
testcase_25 AC 62 ms
78,660 KB
testcase_26 AC 61 ms
78,660 KB
testcase_27 AC 65 ms
78,960 KB
testcase_28 AC 38 ms
53,444 KB
testcase_29 AC 38 ms
53,444 KB
testcase_30 AC 63 ms
79,092 KB
testcase_31 AC 78 ms
84,908 KB
testcase_32 AC 67 ms
82,760 KB
testcase_33 AC 66 ms
80,980 KB
testcase_34 AC 66 ms
80,976 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
a = list(map(int,input().split()))

def calc(x):
    count = 0
    now = 0
    left = 0
    while left < N:
        right = left
        while right < N and now + a[right] <= x:
            now += a[right]
            right += 1
        if now < x:
            return 0
        now = 0
        count += 1
        left = right
    return count
ans = 0
S = sum(a)

i = 1
while i * i <= S:
    if S % i == 0:
        t = calc(i)
        if t > ans:
            ans = t
        t = calc(S // i)
        if t > ans:
            ans = t
    i += 1
print(ans)
0