結果

問題 No.1299 Random Array Score
ユーザー universatouniversato
提出日時 2020-11-27 23:14:05
言語 Crystal
(1.11.2)
結果
AC  
実行時間 112 ms / 2,000 ms
コード長 413 bytes
コンパイル時間 17,515 ms
コンパイル使用メモリ 263,080 KB
実行使用メモリ 31,716 KB
最終ジャッジ日時 2023-09-13 12:49:36
合計ジャッジ時間 21,212 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,780 KB
testcase_01 AC 3 ms
4,736 KB
testcase_02 AC 3 ms
4,704 KB
testcase_03 AC 108 ms
31,716 KB
testcase_04 AC 105 ms
30,732 KB
testcase_05 AC 81 ms
24,860 KB
testcase_06 AC 69 ms
25,308 KB
testcase_07 AC 76 ms
25,592 KB
testcase_08 AC 108 ms
31,064 KB
testcase_09 AC 5 ms
5,708 KB
testcase_10 AC 43 ms
16,308 KB
testcase_11 AC 13 ms
7,448 KB
testcase_12 AC 67 ms
21,288 KB
testcase_13 AC 99 ms
30,120 KB
testcase_14 AC 68 ms
25,264 KB
testcase_15 AC 73 ms
24,652 KB
testcase_16 AC 70 ms
25,192 KB
testcase_17 AC 17 ms
9,060 KB
testcase_18 AC 46 ms
17,960 KB
testcase_19 AC 54 ms
18,432 KB
testcase_20 AC 29 ms
11,912 KB
testcase_21 AC 5 ms
5,448 KB
testcase_22 AC 18 ms
9,104 KB
testcase_23 AC 71 ms
24,208 KB
testcase_24 AC 81 ms
24,400 KB
testcase_25 AC 68 ms
24,792 KB
testcase_26 AC 4 ms
5,372 KB
testcase_27 AC 21 ms
9,828 KB
testcase_28 AC 15 ms
8,336 KB
testcase_29 AC 23 ms
10,156 KB
testcase_30 AC 67 ms
21,640 KB
testcase_31 AC 25 ms
11,488 KB
testcase_32 AC 101 ms
31,272 KB
testcase_33 AC 112 ms
31,404 KB
testcase_34 AC 56 ms
25,256 KB
testcase_35 AC 111 ms
31,392 KB
testcase_36 AC 57 ms
25,096 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

require "big"

struct Int
  def pow(n : Int, mod = nil ) : Int
    a = to_i64
    res = 1_i64
    while n > 0
      if (n & 1) != 0
        res *= a
        res %= mod if mod
      end
      a *= a
      a %= mod if mod
      n >>= 1
    end
    res
  end
end

mod = 998244353i64

n, k = gets.to_s.split.map{ |e| e.to_big_i }
a    = gets.to_s.split.map{ |e| e.to_big_i }

puts a.sum * 2.to_big_i.pow(k, mod) % mod
0