結果

問題 No.2561 みんな大好きmod 998
コンテスト
ユーザー Cecil
提出日時 2023-12-02 15:38:08
言語 Python3
(3.14.7 + numpy 2.5.2 + scipy 1.18.0 + ACL)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 3,512 ms / 4,000 ms
+ 896µs
コード長 320 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 724 ms
コンパイル使用メモリ 21,336 KB
実行使用メモリ 15,916 KB
最終ジャッジ日時 2026-09-05 01:20:59
合計ジャッジ時間 44,246 ms
ジャッジサーバーID
(参考情報)
judge4_1 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 44
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import itertools

N,K = map(int, input().split())
A = list(map(int, input().split()))

l = [ i for i in range(N) ]
product = itertools.combinations(l, K)
ans = 0
for p in product:
    #print(p)
    s = 0
    for i in p:
        s += A[i]
    if s%998244353 <= s%998:
        ans += 1
    ans %= 998
ans %= 998
print(ans)
0