結果
| 問題 | No.1299 Random Array Score |
| コンテスト | |
| ユーザー |
norioc
|
| 提出日時 | 2026-01-22 02:42:20 |
| 言語 | Rust (1.92.0 + proconio + num + itertools) |
| 結果 |
AC
|
| 実行時間 | 17 ms / 2,000 ms |
| コード長 | 620 bytes |
| 記録 | |
| コンパイル時間 | 28,709 ms |
| コンパイル使用メモリ | 412,772 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2026-01-22 02:44:00 |
| 合計ジャッジ時間 | 31,381 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 34 |
コンパイルメッセージ
warning: unused import: `marker::Chars`
--> src/main.rs:2:23
|
2 | use proconio::{input, marker::Chars};
| ^^^^^^^^^^^^^
|
= note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default
ソースコード
#![allow(non_snake_case)]
use proconio::{input, marker::Chars};
fn mod_pow(base: i64, exp: i64, modulus: i64) -> i64 {
if exp == 0 { return 1 }
if exp == 1 { return base % modulus }
let x = mod_pow(base, exp / 2, modulus);
if exp & 1 > 0 {
((x * base) % modulus) * x % modulus
} else {
x * x % modulus
}
}
fn main() {
input! {
N: usize,
K: i64,
A: [i64; N],
}
const MOD: i64 = 998244353;
let mut tot: i64 = 0;
for a in A {
tot = (tot + a) % MOD;
}
let ans = tot * mod_pow(2, K, MOD) % MOD;
println!("{}", ans);
}
norioc