結果

問題 No.1825 Except One
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2022-01-29 10:11:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 188 ms / 3,000 ms
コード長 468 bytes
コンパイル時間 429 ms
コンパイル使用メモリ 87,092 KB
実行使用メモリ 98,912 KB
最終ジャッジ日時 2023-08-30 11:14:13
合計ジャッジ時間 5,421 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
75,732 KB
testcase_01 AC 77 ms
75,840 KB
testcase_02 AC 79 ms
75,584 KB
testcase_03 AC 188 ms
98,300 KB
testcase_04 AC 115 ms
79,016 KB
testcase_05 AC 92 ms
76,424 KB
testcase_06 AC 76 ms
75,744 KB
testcase_07 AC 172 ms
92,736 KB
testcase_08 AC 172 ms
92,944 KB
testcase_09 AC 76 ms
75,700 KB
testcase_10 AC 142 ms
85,496 KB
testcase_11 AC 98 ms
78,480 KB
testcase_12 AC 118 ms
81,748 KB
testcase_13 AC 103 ms
78,208 KB
testcase_14 AC 74 ms
75,860 KB
testcase_15 AC 77 ms
75,584 KB
testcase_16 AC 75 ms
75,724 KB
testcase_17 AC 75 ms
75,552 KB
testcase_18 AC 74 ms
75,596 KB
testcase_19 AC 75 ms
75,836 KB
testcase_20 AC 75 ms
75,636 KB
testcase_21 AC 74 ms
75,832 KB
testcase_22 AC 74 ms
75,724 KB
testcase_23 AC 74 ms
75,796 KB
testcase_24 AC 90 ms
78,012 KB
testcase_25 AC 94 ms
78,660 KB
testcase_26 AC 78 ms
76,004 KB
testcase_27 AC 144 ms
87,812 KB
testcase_28 AC 170 ms
98,912 KB
testcase_29 AC 80 ms
76,092 KB
testcase_30 AC 80 ms
75,684 KB
testcase_31 AC 90 ms
76,432 KB
testcase_32 AC 179 ms
96,020 KB
testcase_33 AC 78 ms
75,860 KB
testcase_34 AC 174 ms
98,736 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
A = sorted(list(map(int,input().split())))
M = (n+2)*100
ans = 0
dp = [[0]*M for i in range(n+1)]

dp[0][0] = 1
for a in A:
    ndp = [[0]*M for i in range(n+1)]

    for i in range(n+1):
        for j in range(M):
            if dp[i][j] == 0:
                continue
            ndp[i][j] += dp[i][j]
            ndp[i+1][j+a] += dp[i][j]
            if i > 0 and a*i <= j+a and (j+a)%i == 0:
                ans += dp[i][j]
    dp = ndp
print(ans)
0