結果

問題 No.2561 みんな大好きmod 998
コンテスト
ユーザー YuuuT
提出日時 2023-12-02 14:48:06
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 510 ms / 4,000 ms
コード長 750 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 172 ms
コンパイル使用メモリ 85,248 KB
実行使用メモリ 81,152 KB
最終ジャッジ日時 2026-04-13 18:58:10
合計ジャッジ時間 9,276 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 44
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import sys,math
#if len(sys.argv)==2:sys.stdin=open(sys.argv[1])
from collections import defaultdict,deque
from itertools import combinations,permutations,accumulate,product
from bisect import bisect,bisect_left,bisect_right
from heapq import heappop,heappush,heapify
#from sortedcontainers import SortedList,SortedSet
def input(): return sys.stdin.readline().rstrip()
def ii(): return int(input())
def ms(): return map(int, input().split())
def li(): return list(map(int,input().split()))
#////////////////////////////////////
N,K = ms()
A = li()
ans = 0
num = [i for i in range(N)]
for com in combinations(num,K):
  s1 = 0
  s2 = 0
  for x in com:
    s1 += A[x]
    s1 %= 998
    s2 += A[x]
    s2 %= 998244353
  if s2<=s1: ans += 1
print(ans%998)
0