結果

問題 No.944 煎っぞ!
ユーザー GrayCoderGrayCoder
提出日時 2019-12-07 10:26:48
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 373 ms / 3,000 ms
コード長 553 bytes
コンパイル時間 99 ms
コンパイル使用メモリ 10,888 KB
実行使用メモリ 19,600 KB
最終ジャッジ日時 2023-08-26 04:30:18
合計ジャッジ時間 5,699 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 247 ms
13,796 KB
testcase_01 AC 125 ms
13,824 KB
testcase_02 AC 72 ms
13,868 KB
testcase_03 AC 90 ms
13,956 KB
testcase_04 AC 314 ms
13,888 KB
testcase_05 AC 54 ms
13,816 KB
testcase_06 AC 58 ms
13,944 KB
testcase_07 AC 90 ms
13,888 KB
testcase_08 AC 276 ms
13,940 KB
testcase_09 AC 62 ms
13,808 KB
testcase_10 AC 17 ms
8,196 KB
testcase_11 AC 52 ms
10,304 KB
testcase_12 AC 36 ms
9,484 KB
testcase_13 AC 16 ms
8,292 KB
testcase_14 AC 56 ms
10,300 KB
testcase_15 AC 36 ms
9,024 KB
testcase_16 AC 16 ms
8,232 KB
testcase_17 AC 16 ms
8,108 KB
testcase_18 AC 52 ms
10,312 KB
testcase_19 AC 51 ms
10,408 KB
testcase_20 AC 83 ms
18,992 KB
testcase_21 AC 84 ms
19,032 KB
testcase_22 AC 70 ms
13,368 KB
testcase_23 AC 128 ms
13,172 KB
testcase_24 AC 373 ms
13,248 KB
testcase_25 AC 82 ms
13,264 KB
testcase_26 AC 83 ms
13,172 KB
testcase_27 AC 338 ms
18,236 KB
testcase_28 AC 16 ms
8,112 KB
testcase_29 AC 16 ms
8,236 KB
testcase_30 AC 129 ms
19,600 KB
testcase_31 AC 49 ms
13,256 KB
testcase_32 AC 52 ms
13,364 KB
testcase_33 AC 74 ms
16,124 KB
testcase_34 AC 86 ms
15,948 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import accumulate
from sys import stdin


def main():
    input = lambda: stdin.readline()[:-1]
    N = int(input())
    A = map(int, input().split())

    if N == 1:
        print(1)
        return

    a = tuple(accumulate(A))
    for n in range(N, 0, -1):
        d, m = divmod(a[-1], n)
        if m:
            continue
        ans = 0
        for ai in a[::-1]:
            if ai == d * n:
                ans += 1
                n -= 1
                if not n:
                    print(ans)
                    return


main()
0