結果

問題 No.1299 Random Array Score
ユーザー marroncastlemarroncastle
提出日時 2020-11-27 21:41:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 129 ms / 2,000 ms
コード長 1,622 bytes
コンパイル時間 1,104 ms
コンパイル使用メモリ 86,700 KB
実行使用メモリ 104,000 KB
最終ジャッジ日時 2023-10-01 05:09:18
合計ジャッジ時間 5,698 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,088 KB
testcase_01 AC 70 ms
71,084 KB
testcase_02 AC 71 ms
71,100 KB
testcase_03 AC 129 ms
100,064 KB
testcase_04 AC 125 ms
99,864 KB
testcase_05 AC 107 ms
100,744 KB
testcase_06 AC 104 ms
97,340 KB
testcase_07 AC 107 ms
97,764 KB
testcase_08 AC 126 ms
99,856 KB
testcase_09 AC 76 ms
75,472 KB
testcase_10 AC 91 ms
86,720 KB
testcase_11 AC 78 ms
76,556 KB
testcase_12 AC 101 ms
95,060 KB
testcase_13 AC 125 ms
99,304 KB
testcase_14 AC 102 ms
95,100 KB
testcase_15 AC 105 ms
97,648 KB
testcase_16 AC 104 ms
97,472 KB
testcase_17 AC 80 ms
77,828 KB
testcase_18 AC 93 ms
88,304 KB
testcase_19 AC 94 ms
90,220 KB
testcase_20 AC 87 ms
82,632 KB
testcase_21 AC 77 ms
75,436 KB
testcase_22 AC 81 ms
78,344 KB
testcase_23 AC 105 ms
97,360 KB
testcase_24 AC 109 ms
100,412 KB
testcase_25 AC 103 ms
95,248 KB
testcase_26 AC 76 ms
75,908 KB
testcase_27 AC 82 ms
79,016 KB
testcase_28 AC 81 ms
77,172 KB
testcase_29 AC 85 ms
80,604 KB
testcase_30 AC 101 ms
95,016 KB
testcase_31 AC 83 ms
80,636 KB
testcase_32 AC 126 ms
99,288 KB
testcase_33 AC 126 ms
101,040 KB
testcase_34 AC 105 ms
103,604 KB
testcase_35 AC 123 ms
101,076 KB
testcase_36 AC 108 ms
104,000 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 998244353
class ModInt:
  def __init__(self, x):
    self.x = x % MOD

  def __str__(self):
    return str(self.x)

  __repr__ = __str__

  def __add__(self, other):
    return (
      ModInt(self.x + other.x) if isinstance(other, ModInt) else
      ModInt(self.x + other)
    )

  def __sub__(self, other):
    return (
      ModInt(self.x - other.x) if isinstance(other, ModInt) else
      ModInt(self.x - other)
    )

  def __mul__(self, other):
    return (
      ModInt(self.x * other.x) if isinstance(other, ModInt) else
      ModInt(self.x * other)
    )

  def __truediv__(self, other):
    return (
      ModInt(
        self.x * pow(other.x, MOD - 2, MOD)
      ) if isinstance(other, ModInt) else
      ModInt(self.x * pow(other, MOD - 2, MOD))
    )

  __floordiv__ = __truediv__

  def __pow__(self, other):
    return (
      ModInt(pow(self.x, other.x, MOD)) if isinstance(other, ModInt) else
      ModInt(pow(self.x, other, MOD))
    )

  __radd__ = __add__

  def __rsub__(self, other):
    return (
      ModInt(other.x - self.x) if isinstance(other, ModInt) else
      ModInt(other - self.x)
    )

  __rmul__ = __mul__

  def __rtruediv__(self, other):
    return (
      ModInt(
        other.x * pow(self.x, MOD - 2, MOD)
      ) if isinstance(other, ModInt) else
      ModInt(other * pow(self.x, MOD - 2, MOD))
    )

  def __rpow__(self, other):
    return (
      ModInt(pow(other.x, self.x, MOD)) if isinstance(other, ModInt) else
      ModInt(pow(other, self.x, MOD))
    )

N, K = map(int, input().split())
A = list(map(int, input().split()))
S = ModInt(sum(A))
print(S*pow(ModInt(2),K))
0