結果
問題 | No.2561 みんな大好きmod 998 |
ユーザー | 21kazu13 |
提出日時 | 2023-12-04 13:33:39 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 639 ms / 4,000 ms |
コード長 | 1,319 bytes |
コンパイル時間 | 544 ms |
コンパイル使用メモリ | 81,700 KB |
実行使用メモリ | 76,996 KB |
最終ジャッジ日時 | 2023-12-04 13:33:51 |
合計ジャッジ時間 | 11,112 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 56 ms
65,924 KB |
testcase_01 | AC | 90 ms
76,736 KB |
testcase_02 | AC | 57 ms
65,924 KB |
testcase_03 | AC | 595 ms
76,736 KB |
testcase_04 | AC | 591 ms
76,732 KB |
testcase_05 | AC | 631 ms
76,740 KB |
testcase_06 | AC | 610 ms
76,736 KB |
testcase_07 | AC | 58 ms
65,924 KB |
testcase_08 | AC | 55 ms
65,924 KB |
testcase_09 | AC | 67 ms
70,736 KB |
testcase_10 | AC | 56 ms
65,924 KB |
testcase_11 | AC | 147 ms
76,740 KB |
testcase_12 | AC | 55 ms
65,924 KB |
testcase_13 | AC | 55 ms
65,924 KB |
testcase_14 | AC | 56 ms
65,924 KB |
testcase_15 | AC | 581 ms
76,996 KB |
testcase_16 | AC | 57 ms
65,924 KB |
testcase_17 | AC | 55 ms
65,924 KB |
testcase_18 | AC | 67 ms
68,652 KB |
testcase_19 | AC | 466 ms
76,868 KB |
testcase_20 | AC | 64 ms
68,648 KB |
testcase_21 | AC | 56 ms
65,924 KB |
testcase_22 | AC | 56 ms
65,924 KB |
testcase_23 | AC | 59 ms
66,564 KB |
testcase_24 | AC | 55 ms
65,924 KB |
testcase_25 | AC | 58 ms
65,924 KB |
testcase_26 | AC | 168 ms
76,732 KB |
testcase_27 | AC | 611 ms
76,736 KB |
testcase_28 | AC | 175 ms
76,716 KB |
testcase_29 | AC | 96 ms
76,716 KB |
testcase_30 | AC | 205 ms
76,736 KB |
testcase_31 | AC | 345 ms
76,736 KB |
testcase_32 | AC | 106 ms
76,716 KB |
testcase_33 | AC | 95 ms
76,716 KB |
testcase_34 | AC | 639 ms
76,736 KB |
testcase_35 | AC | 93 ms
76,716 KB |
testcase_36 | AC | 92 ms
76,716 KB |
testcase_37 | AC | 79 ms
76,720 KB |
testcase_38 | AC | 122 ms
76,720 KB |
testcase_39 | AC | 195 ms
76,740 KB |
testcase_40 | AC | 196 ms
76,740 KB |
testcase_41 | AC | 131 ms
76,720 KB |
testcase_42 | AC | 164 ms
76,720 KB |
testcase_43 | AC | 78 ms
76,720 KB |
testcase_44 | AC | 105 ms
76,720 KB |
testcase_45 | AC | 448 ms
76,740 KB |
testcase_46 | AC | 100 ms
76,720 KB |
ソースコード
#!/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)