結果
| 問題 | No.2561 みんな大好きmod 998 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2023-12-02 14:51:02 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 532 ms / 4,000 ms | 
| コード長 | 743 bytes | 
| コンパイル時間 | 549 ms | 
| コンパイル使用メモリ | 82,564 KB | 
| 実行使用メモリ | 81,408 KB | 
| 最終ジャッジ日時 | 2024-09-26 17:32:20 | 
| 合計ジャッジ時間 | 10,537 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 44 | 
ソースコード
from collections import defaultdict, deque, Counter
import copy
from itertools import combinations, permutations, product, accumulate, groupby, chain
from heapq import heapify, heappop, heappush
import math
import bisect
from pprint import pprint
from random import randint
import sys
# sys.setrecursionlimit(200000)
input = lambda: sys.stdin.readline().rstrip('\n')
inf = float('inf')
mod1 = 10**9+7
mod2 = 998244353
def ceil_div(x, y): return -(-x//y)
#################################################    
N, K = map(int, input().split())
A = list(map(int, input().split()))
ans = 0
for C in combinations(A, K):
    s, t = 0, 0
    for c in C:
        s = (s+c)%998
        t = (t+c)%998244353
    ans += (t <= s)
    ans %= 998
print(ans)
            
            
            
        