結果

問題 No.1359 [Zelkova 3rd Tune] 四人セゾン
ユーザー phsplsphspls
提出日時 2022-10-08 11:58:54
言語 Rust
(1.77.0)
結果
AC  
実行時間 367 ms / 2,000 ms
コード長 1,417 bytes
コンパイル時間 16,476 ms
コンパイル使用メモリ 382,880 KB
実行使用メモリ 16,768 KB
最終ジャッジ日時 2024-06-22 12:57:33
合計ジャッジ時間 40,017 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 2 ms
6,816 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 268 ms
9,472 KB
testcase_04 AC 144 ms
9,472 KB
testcase_05 AC 124 ms
9,344 KB
testcase_06 AC 123 ms
9,344 KB
testcase_07 AC 193 ms
12,544 KB
testcase_08 AC 192 ms
12,416 KB
testcase_09 AC 54 ms
6,940 KB
testcase_10 AC 55 ms
6,940 KB
testcase_11 AC 259 ms
15,360 KB
testcase_12 AC 256 ms
15,232 KB
testcase_13 AC 164 ms
10,496 KB
testcase_14 AC 162 ms
10,624 KB
testcase_15 AC 142 ms
9,344 KB
testcase_16 AC 143 ms
9,344 KB
testcase_17 AC 269 ms
15,744 KB
testcase_18 AC 272 ms
15,744 KB
testcase_19 AC 235 ms
14,080 KB
testcase_20 AC 235 ms
14,080 KB
testcase_21 AC 319 ms
14,976 KB
testcase_22 AC 254 ms
14,976 KB
testcase_23 AC 183 ms
11,264 KB
testcase_24 AC 203 ms
11,136 KB
testcase_25 AC 45 ms
6,940 KB
testcase_26 AC 32 ms
6,940 KB
testcase_27 AC 136 ms
6,944 KB
testcase_28 AC 112 ms
6,940 KB
testcase_29 AC 124 ms
7,680 KB
testcase_30 AC 131 ms
7,680 KB
testcase_31 AC 162 ms
9,728 KB
testcase_32 AC 199 ms
9,600 KB
testcase_33 AC 113 ms
7,680 KB
testcase_34 AC 109 ms
7,680 KB
testcase_35 AC 149 ms
9,472 KB
testcase_36 AC 144 ms
9,472 KB
testcase_37 AC 28 ms
6,944 KB
testcase_38 AC 29 ms
6,940 KB
testcase_39 AC 24 ms
6,940 KB
testcase_40 AC 24 ms
6,940 KB
testcase_41 AC 52 ms
6,940 KB
testcase_42 AC 51 ms
6,940 KB
testcase_43 AC 40 ms
6,948 KB
testcase_44 AC 272 ms
16,128 KB
testcase_45 AC 114 ms
7,808 KB
testcase_46 AC 39 ms
6,940 KB
testcase_47 AC 190 ms
11,648 KB
testcase_48 AC 179 ms
11,392 KB
testcase_49 AC 180 ms
11,648 KB
testcase_50 AC 139 ms
9,344 KB
testcase_51 AC 7 ms
6,944 KB
testcase_52 AC 247 ms
14,336 KB
testcase_53 AC 270 ms
16,640 KB
testcase_54 AC 288 ms
16,640 KB
testcase_55 AC 281 ms
16,640 KB
testcase_56 AC 286 ms
16,768 KB
testcase_57 AC 287 ms
16,640 KB
testcase_58 AC 287 ms
16,640 KB
testcase_59 AC 287 ms
16,640 KB
testcase_60 AC 280 ms
16,640 KB
testcase_61 AC 258 ms
16,768 KB
testcase_62 AC 367 ms
16,640 KB
testcase_63 AC 288 ms
16,768 KB
testcase_64 AC 288 ms
16,640 KB
testcase_65 AC 283 ms
16,640 KB
testcase_66 AC 286 ms
16,640 KB
testcase_67 AC 291 ms
16,512 KB
testcase_68 AC 278 ms
16,640 KB
testcase_69 AC 256 ms
16,640 KB
testcase_70 AC 256 ms
16,640 KB
testcase_71 AC 239 ms
16,768 KB
testcase_72 AC 289 ms
16,640 KB
testcase_73 AC 253 ms
16,512 KB
testcase_74 AC 250 ms
16,640 KB
testcase_75 AC 253 ms
16,640 KB
testcase_76 AC 248 ms
16,640 KB
testcase_77 AC 255 ms
16,640 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: variable `MOD` should have a snake case name
 --> src/main.rs:2:37
  |
2 | fn power(base: usize, times: usize, MOD: usize) -> usize {
  |                                     ^^^
  |
  = note: `#[warn(non_snake_case)]` on by default
help: rename the identifier or convert it to a snake case raw identifier
  |
2 | fn power(base: usize, times: usize, r#mod: usize) -> usize {
  |                                     ~~~~~

warning: variable `MOD` should have a snake case name
  --> src/main.rs:15:9
   |
15 |     let MOD = nkm[2];
   |         ^^^
   |
help: rename the identifier or convert it to a snake case raw identifier
   |
15 |     let r#mod = nkm[2];
   |         ~~~~~

ソースコード

diff #

fn power(base: usize, times: usize, MOD: usize) -> usize {
    if times == 0 { return 1usize % MOD; }
    if times == 1 { return base % MOD; }
    let temp = power(base, times/2, MOD);
    temp * temp % MOD * power(base, times%2, MOD) % MOD
}

fn main() {
    let mut nkm = String::new();
    std::io::stdin().read_line(&mut nkm).ok();
    let nkm: Vec<usize> = nkm.trim().split_whitespace().map(|s| s.parse().unwrap()).collect();
    let n = nkm[0];
    let k = nkm[1];
    let MOD = nkm[2];
    let mut p = String::new();
    std::io::stdin().read_line(&mut p).ok();
    let mut p: Vec<usize> = p.trim().split_whitespace().map(|s| s.parse().unwrap()).collect();
    let mut e = String::new();
    std::io::stdin().read_line(&mut e).ok();
    let mut e: Vec<usize> = e.trim().split_whitespace().map(|s| s.parse().unwrap()).collect();
    let mut a = String::new();
    std::io::stdin().read_line(&mut a).ok();
    let mut a: Vec<usize> = a.trim().split_whitespace().map(|s| s.parse().unwrap()).collect();
    let mut h = String::new();
    std::io::stdin().read_line(&mut h).ok();
    let mut h: Vec<usize> = h.trim().split_whitespace().map(|s| s.parse().unwrap()).collect();

    p.sort();
    e.sort();
    a.sort();
    h.sort();
    let result = (0..n).map(|i| p[i].max(e[i]).max(a[i]).max(h[i]) - p[i].min(e[i]).min(a[i]).min(h[i])).map(|v| power(v, k, MOD)).sum::<usize>() % MOD;
    println!("{}", result);
}
0