結果

問題 No.2561 みんな大好きmod 998
コンテスト
ユーザー Lucagon
提出日時 2023-12-02 14:53:33
言語 PyPy3
(7.3.23 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 1,041 ms / 4,000 ms
+ 952µs
コード長 373 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 236 ms
コンパイル使用メモリ 96,088 KB
実行使用メモリ 495,216 KB
最終ジャッジ日時 2026-09-05 00:50:22
合計ジャッジ時間 15,135 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 44
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from itertools import combinations

n,k = map(int,input().split())
a = list(map(int,input().split()))
c = list(combinations(a,k))

ans = 0
amod = 998244353
bmod = 998
for i in c:
    cnt1 = 0
    cnt2 = 0
    for j in i:
        cnt1 += j
        cnt2 += j
        cnt1 %= amod
        cnt2 %= bmod
    
    if cnt1 <= cnt2:
        ans += 1
        ans %= bmod

print(ans)
0