結果

問題 No.1825 Except One
ユーザー mkawa2mkawa2
提出日時 2022-01-29 00:09:48
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,131 bytes
コンパイル時間 281 ms
コンパイル使用メモリ 86,840 KB
実行使用メモリ 76,596 KB
最終ジャッジ日時 2023-08-28 23:04:16
合計ジャッジ時間 4,865 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,076 KB
testcase_01 AC 73 ms
70,804 KB
testcase_02 AC 77 ms
75,260 KB
testcase_03 AC 97 ms
76,268 KB
testcase_04 AC 88 ms
76,028 KB
testcase_05 AC 83 ms
75,628 KB
testcase_06 AC 76 ms
75,236 KB
testcase_07 AC 92 ms
76,340 KB
testcase_08 AC 93 ms
76,016 KB
testcase_09 AC 78 ms
75,188 KB
testcase_10 AC 90 ms
75,980 KB
testcase_11 AC 87 ms
75,976 KB
testcase_12 AC 88 ms
76,056 KB
testcase_13 AC 84 ms
76,020 KB
testcase_14 AC 75 ms
71,116 KB
testcase_15 AC 77 ms
75,184 KB
testcase_16 AC 76 ms
75,104 KB
testcase_17 AC 73 ms
70,980 KB
testcase_18 WA -
testcase_19 AC 78 ms
75,236 KB
testcase_20 AC 77 ms
75,484 KB
testcase_21 AC 74 ms
71,060 KB
testcase_22 AC 74 ms
70,980 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 81 ms
75,928 KB
testcase_26 AC 78 ms
75,296 KB
testcase_27 AC 88 ms
75,812 KB
testcase_28 WA -
testcase_29 AC 78 ms
75,684 KB
testcase_30 AC 78 ms
75,256 KB
testcase_31 AC 81 ms
75,660 KB
testcase_32 AC 93 ms
75,832 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

# 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(50*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