結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
75,600 KB
testcase_01 AC 75 ms
75,692 KB
testcase_02 AC 75 ms
75,440 KB
testcase_03 AC 110 ms
76,308 KB
testcase_04 AC 91 ms
76,440 KB
testcase_05 AC 83 ms
76,096 KB
testcase_06 AC 77 ms
75,636 KB
testcase_07 AC 107 ms
76,560 KB
testcase_08 AC 105 ms
76,440 KB
testcase_09 AC 77 ms
75,544 KB
testcase_10 AC 97 ms
76,680 KB
testcase_11 AC 85 ms
76,476 KB
testcase_12 AC 89 ms
76,208 KB
testcase_13 AC 87 ms
76,440 KB
testcase_14 AC 72 ms
71,140 KB
testcase_15 AC 75 ms
75,596 KB
testcase_16 AC 76 ms
75,716 KB
testcase_17 AC 77 ms
75,576 KB
testcase_18 AC 74 ms
71,184 KB
testcase_19 AC 74 ms
75,548 KB
testcase_20 AC 76 ms
75,476 KB
testcase_21 AC 76 ms
75,548 KB
testcase_22 AC 77 ms
75,860 KB
testcase_23 AC 79 ms
75,544 KB
testcase_24 AC 88 ms
76,492 KB
testcase_25 AC 83 ms
76,172 KB
testcase_26 AC 76 ms
75,572 KB
testcase_27 AC 93 ms
76,512 KB
testcase_28 AC 98 ms
76,532 KB
testcase_29 AC 76 ms
75,900 KB
testcase_30 AC 77 ms
75,692 KB
testcase_31 AC 83 ms
76,192 KB
testcase_32 AC 108 ms
76,320 KB
testcase_33 AC 77 ms
75,576 KB
testcase_34 AC 99 ms
76,300 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 ind,a in enumerate(A):
    for i in range(ind+1)[::-1]:
        for j in range(100*(ind+1))[::-1]:
            if dp[i][j] == 0:
                continue
            dp[i+1][j+a] += dp[i][j]
            if i and a*i <= j+a and (j+a)%i == 0:
                ans += dp[i][j]
print(ans)
0