結果

問題 No.2561 みんな大好きmod 998
ユーザー nzm_ortnzm_ort
提出日時 2023-12-02 15:07:07
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,539 ms / 4,000 ms
コード長 373 bytes
コンパイル時間 97 ms
コンパイル使用メモリ 11,776 KB
実行使用メモリ 9,984 KB
最終ジャッジ日時 2023-12-02 15:07:31
合計ジャッジ時間 18,989 ms
ジャッジサーバーID
(参考情報)
judge12 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
9,984 KB
testcase_01 AC 104 ms
9,984 KB
testcase_02 AC 29 ms
9,984 KB
testcase_03 AC 1,336 ms
9,984 KB
testcase_04 AC 1,302 ms
9,984 KB
testcase_05 AC 1,539 ms
9,984 KB
testcase_06 AC 1,314 ms
9,984 KB
testcase_07 AC 30 ms
9,984 KB
testcase_08 AC 29 ms
9,984 KB
testcase_09 AC 32 ms
9,984 KB
testcase_10 AC 29 ms
9,984 KB
testcase_11 AC 253 ms
9,984 KB
testcase_12 AC 30 ms
9,984 KB
testcase_13 AC 30 ms
9,984 KB
testcase_14 AC 29 ms
9,984 KB
testcase_15 AC 1,507 ms
9,984 KB
testcase_16 AC 29 ms
9,984 KB
testcase_17 AC 29 ms
9,984 KB
testcase_18 AC 30 ms
9,984 KB
testcase_19 AC 1,119 ms
9,984 KB
testcase_20 AC 30 ms
9,984 KB
testcase_21 AC 29 ms
9,984 KB
testcase_22 AC 29 ms
9,984 KB
testcase_23 AC 30 ms
9,984 KB
testcase_24 AC 29 ms
9,984 KB
testcase_25 AC 29 ms
9,984 KB
testcase_26 AC 324 ms
9,984 KB
testcase_27 AC 1,271 ms
9,984 KB
testcase_28 AC 377 ms
9,984 KB
testcase_29 AC 131 ms
9,984 KB
testcase_30 AC 369 ms
9,984 KB
testcase_31 AC 707 ms
9,984 KB
testcase_32 AC 150 ms
9,984 KB
testcase_33 AC 132 ms
9,984 KB
testcase_34 AC 1,283 ms
9,984 KB
testcase_35 AC 108 ms
9,984 KB
testcase_36 AC 106 ms
9,984 KB
testcase_37 AC 74 ms
9,984 KB
testcase_38 AC 283 ms
9,984 KB
testcase_39 AC 427 ms
9,984 KB
testcase_40 AC 427 ms
9,984 KB
testcase_41 AC 256 ms
9,984 KB
testcase_42 AC 435 ms
9,984 KB
testcase_43 AC 73 ms
9,984 KB
testcase_44 AC 199 ms
9,984 KB
testcase_45 AC 1,145 ms
9,984 KB
testcase_46 AC 150 ms
9,984 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(100000)
n, k = map(int, input().split())
a = list(map(int, input().split()))
mod1 = 998
mod2 = 998244353

ans = 0

def dfs(idx, s, num):
    global ans
    if num==k:
        if s%mod1>=s%mod2: ans+=1
        return

    for i in range(idx+1, n):
        dfs(i, s+a[i], num+1)
        
for j in range(n):
    dfs(j, a[j], 1)
print(ans%mod1)
0