結果

問題 No.1825 Except One
ユーザー mkawa2mkawa2
提出日時 2022-01-28 21:58:35
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,247 bytes
コンパイル時間 262 ms
コンパイル使用メモリ 86,944 KB
実行使用メモリ 78,480 KB
最終ジャッジ日時 2023-08-28 19:54:27
合計ジャッジ時間 5,166 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 99 ms
76,872 KB
testcase_01 AC 101 ms
76,912 KB
testcase_02 AC 102 ms
77,100 KB
testcase_03 AC 119 ms
78,296 KB
testcase_04 AC 107 ms
78,216 KB
testcase_05 AC 101 ms
78,012 KB
testcase_06 AC 96 ms
77,156 KB
testcase_07 AC 113 ms
78,228 KB
testcase_08 AC 113 ms
78,480 KB
testcase_09 AC 97 ms
77,316 KB
testcase_10 AC 110 ms
78,264 KB
testcase_11 AC 104 ms
78,220 KB
testcase_12 AC 106 ms
78,216 KB
testcase_13 AC 104 ms
78,240 KB
testcase_14 AC 95 ms
77,012 KB
testcase_15 AC 96 ms
77,036 KB
testcase_16 AC 96 ms
77,108 KB
testcase_17 AC 94 ms
76,912 KB
testcase_18 WA -
testcase_19 AC 97 ms
77,272 KB
testcase_20 AC 96 ms
76,956 KB
testcase_21 AC 95 ms
77,136 KB
testcase_22 AC 95 ms
76,944 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 100 ms
77,988 KB
testcase_26 AC 97 ms
77,192 KB
testcase_27 AC 107 ms
78,236 KB
testcase_28 WA -
testcase_29 AC 97 ms
77,304 KB
testcase_30 AC 98 ms
77,440 KB
testcase_31 AC 99 ms
77,680 KB
testcase_32 AC 109 ms
78,448 KB
testcase_33 WA -
testcase_34 WA -
権限があれば一括ダウンロードができます

ソースコード

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

from collections import defaultdict

# 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, -1, -1):
        for s in range(50*i+1):
            pre = dp[m][s]
            if pre == 0: continue
            if s+a >= a*m:
                dp[m+1][s+a] += pre
    dp[1][a] += 1
# p2D(dp)

ans = 0
for m in range(2, n+1):
    for i in range(5001):
        if (m-1)*i > 5000: break
        ans += dp[m][(m-1)*i]

print(ans)
0