結果
問題 |
No.2561 みんな大好きmod 998
|
ユーザー |
|
提出日時 | 2023-12-04 13:33:39 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 617 ms / 4,000 ms |
コード長 | 1,319 bytes |
コンパイル時間 | 235 ms |
コンパイル使用メモリ | 82,592 KB |
実行使用メモリ | 77,568 KB |
最終ジャッジ日時 | 2024-09-26 22:56:27 |
合計ジャッジ時間 | 10,728 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 44 |
ソースコード
#!/usr/bin/env python3 import sys from bisect import bisect_left, bisect_right, insort_left, insort_right # type: ignore from collections import Counter, defaultdict, deque # type: ignore from math import gcd, sqrt, ceil, factorial # type: ignore from heapq import heapify, heappop, heappush, heappushpop, heapreplace, merge # type: ignore from itertools import accumulate, combinations, permutations, product # type: ignore from string import ascii_lowercase, ascii_uppercase # type: ignore def LI(): return list(map(int, sys.stdin.buffer.readline().split())) def I(): return int(sys.stdin.buffer.readline()) def LS(): return sys.stdin.buffer.readline().rstrip().decode("utf-8").split() def S(): return sys.stdin.buffer.readline().rstrip().decode("utf-8") def IR(n): return [I() for _ in range(n)] def LIR(n): return [LI() for _ in range(n)] def SR(n): return [S() for _ in range(n)] def LSR(n): return [LS() for _ in range(n)] def SRL(n): return [list(S()) for _ in range(n)] # 28C14=40116600~4*10^7 N,K = LI() A = LI() MOD = 998244353 ans = 0 for p in combinations(range(N),K): s998 = 0 smod = 0 for i in p: s998 += A[i]%998 if s998>=998: s998 -= 998 smod += A[i] if smod>=MOD: smod -= MOD if smod<=s998: ans += 1 print(ans%998)