結果

問題 No.1825 Except One
ユーザー mkawa2mkawa2
提出日時 2022-01-29 00:17:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 107 ms / 3,000 ms
コード長 1,132 bytes
コンパイル時間 984 ms
コンパイル使用メモリ 87,164 KB
実行使用メモリ 76,612 KB
最終ジャッジ日時 2023-08-30 11:13:07
合計ジャッジ時間 5,491 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
71,528 KB
testcase_01 AC 78 ms
71,304 KB
testcase_02 AC 81 ms
75,516 KB
testcase_03 AC 105 ms
76,448 KB
testcase_04 AC 92 ms
76,200 KB
testcase_05 AC 85 ms
76,088 KB
testcase_06 AC 77 ms
75,524 KB
testcase_07 AC 104 ms
76,448 KB
testcase_08 AC 102 ms
76,284 KB
testcase_09 AC 80 ms
75,592 KB
testcase_10 AC 95 ms
76,284 KB
testcase_11 AC 88 ms
76,464 KB
testcase_12 AC 94 ms
76,204 KB
testcase_13 AC 89 ms
76,380 KB
testcase_14 AC 77 ms
71,352 KB
testcase_15 AC 78 ms
75,588 KB
testcase_16 AC 81 ms
75,628 KB
testcase_17 AC 75 ms
71,372 KB
testcase_18 AC 76 ms
71,504 KB
testcase_19 AC 76 ms
75,700 KB
testcase_20 AC 78 ms
75,808 KB
testcase_21 AC 77 ms
71,356 KB
testcase_22 AC 80 ms
75,540 KB
testcase_23 AC 79 ms
75,520 KB
testcase_24 AC 83 ms
76,612 KB
testcase_25 AC 84 ms
76,536 KB
testcase_26 AC 79 ms
75,536 KB
testcase_27 AC 98 ms
76,596 KB
testcase_28 AC 103 ms
76,392 KB
testcase_29 AC 81 ms
76,044 KB
testcase_30 AC 82 ms
75,684 KB
testcase_31 AC 86 ms
76,096 KB
testcase_32 AC 107 ms
76,572 KB
testcase_33 AC 80 ms
75,752 KB
testcase_34 AC 102 ms
76,244 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

# sys.setrecursionlimit(200005)
int1 = lambda x: int(x)-1
pDB = lambda *x: print(*x, end="\n", file=sys.stderr)
p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr)
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def SI(): return sys.stdin.readline().rstrip()
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
# inf = (1<<63)-1
inf = (1 << 32)-1
# md = 10**9+7
md = 998244353

# size,sum
# 5000*100*50
# 125000000

n = II()
aa = sorted(LI())
dp = [[0]*5001 for _ in range(n+1)]

ans = 0
for i, a in enumerate(aa):
    for m in range(i, 0, -1):
        for s in range(100*i+1):
            pre = dp[m][s]
            if pre == 0: continue
            if s+a >= a*m:
                dp[m+1][s+a] += pre
                if (s+a)%m == 0: ans += pre
    dp[1][a] += 1
# p2D(dp)

print(ans)
0