結果

問題 No.1238 選抜クラス
ユーザー ygd.ygd.
提出日時 2021-07-02 00:39:05
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 758 bytes
コンパイル時間 296 ms
コンパイル使用メモリ 87,208 KB
実行使用メモリ 93,376 KB
最終ジャッジ日時 2023-09-10 22:23:45
合計ジャッジ時間 6,337 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,432 KB
testcase_01 AC 79 ms
75,544 KB
testcase_02 AC 77 ms
75,452 KB
testcase_03 AC 71 ms
71,460 KB
testcase_04 AC 72 ms
71,364 KB
testcase_05 AC 70 ms
71,420 KB
testcase_06 AC 71 ms
71,224 KB
testcase_07 AC 76 ms
75,364 KB
testcase_08 AC 76 ms
75,516 KB
testcase_09 AC 78 ms
75,684 KB
testcase_10 AC 77 ms
75,620 KB
testcase_11 AC 78 ms
75,460 KB
testcase_12 AC 77 ms
75,568 KB
testcase_13 AC 77 ms
75,728 KB
testcase_14 AC 77 ms
75,348 KB
testcase_15 AC 77 ms
75,468 KB
testcase_16 AC 79 ms
75,628 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 134 ms
91,512 KB
testcase_20 WA -
testcase_21 AC 128 ms
90,600 KB
testcase_22 WA -
testcase_23 AC 140 ms
91,560 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 135 ms
92,528 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 79 ms
75,580 KB
testcase_31 WA -
testcase_32 AC 103 ms
77,016 KB
testcase_33 AC 81 ms
75,464 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 78 ms
75,288 KB
testcase_37 WA -
testcase_38 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    N,K = map(int,input().split())
    A = list(map(int,input().split()))
    A = [a - K for a in A] #平均を引く
    #print(A)
    #合計点の範囲は-100点~100点×人数
    MAX = 210*N
    dp = [0]*MAX
    base = 105*N
    #dp[base-K] = 1 #0点誰も選ばないとき。K==0の時は最後引かないとだめ。
    #dp[i] = i + base点となる場合の数
    for i in range(N):
        p = [0]*MAX
        dp,p = p,dp
        #i番目の人のみ選ばれる場合
        dp[A[i]+base] += 1
        for j in range(MAX):
            dp[j] += p[j]
            if 0 <= j+A[i] < MAX:
                dp[j+A[i]] += p[j]
        #print(dp)
    #print(dp)
    ans = sum(dp[base:])
    print(ans)

if __name__ == '__main__':
    main()
0