結果

問題 No.1825 Except One
ユーザー brthyyjpbrthyyjp
提出日時 2022-01-28 22:14:08
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 2,174 ms / 3,000 ms
コード長 932 bytes
コンパイル時間 649 ms
コンパイル使用メモリ 87,276 KB
実行使用メモリ 291,400 KB
最終ジャッジ日時 2023-08-30 11:08:56
合計ジャッジ時間 14,572 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 95 ms
71,920 KB
testcase_01 AC 97 ms
71,768 KB
testcase_02 AC 97 ms
71,932 KB
testcase_03 AC 2,174 ms
291,400 KB
testcase_04 AC 464 ms
149,776 KB
testcase_05 AC 155 ms
82,528 KB
testcase_06 AC 98 ms
71,576 KB
testcase_07 AC 2,159 ms
273,664 KB
testcase_08 AC 1,864 ms
275,108 KB
testcase_09 AC 98 ms
71,836 KB
testcase_10 AC 1,029 ms
211,496 KB
testcase_11 AC 220 ms
103,520 KB
testcase_12 AC 525 ms
168,220 KB
testcase_13 AC 268 ms
123,660 KB
testcase_14 AC 96 ms
71,784 KB
testcase_15 AC 99 ms
71,780 KB
testcase_16 AC 97 ms
71,752 KB
testcase_17 AC 95 ms
71,744 KB
testcase_18 AC 95 ms
71,548 KB
testcase_19 AC 99 ms
71,652 KB
testcase_20 AC 99 ms
71,692 KB
testcase_21 AC 99 ms
71,756 KB
testcase_22 AC 97 ms
71,788 KB
testcase_23 AC 100 ms
71,768 KB
testcase_24 AC 98 ms
71,572 KB
testcase_25 AC 99 ms
71,656 KB
testcase_26 AC 98 ms
71,824 KB
testcase_27 AC 103 ms
75,960 KB
testcase_28 AC 108 ms
77,472 KB
testcase_29 AC 105 ms
76,056 KB
testcase_30 AC 100 ms
71,892 KB
testcase_31 AC 152 ms
81,500 KB
testcase_32 AC 1,030 ms
199,240 KB
testcase_33 AC 98 ms
71,676 KB
testcase_34 AC 105 ms
77,636 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():

    n = int(input())
    A = list(map(int, input().split()))

    #A.sort(reverse=True)

    from collections import defaultdict
    dp = defaultdict(lambda: 0)
    def getindex(k, s, M):
        return (k<<36)+(s<<18)+M
    dp[getindex(0, 0, 0)] = 1
    for a in A:
        nx = defaultdict(lambda: 0)
        for p, v in dp.items():
            k = p>>36
            r = p-(k<<36)
            s = r>>18
            M = r-(s<<18)
            #if s < M*(k-1):
                #continue
            nx[getindex(k, s, M)] += v
            nx[getindex(k+1, s+a, max(M, a))] += v
        dp = nx
    #print(dp)
    ans = 0
    for p, v in dp.items():
        k = p>>36
        r = p-(k<<36)
        s = r>>18
        M = r-(s<<18)
        if k <= 1:
            continue
        if s%(k-1) == 0:
            x = s//(k-1)
            if x >= M:
                ans += v
    print(ans)

if __name__ == '__main__':
    main()
0