結果

問題 No.1359 [Zelkova 3rd Tune] 四人セゾン
ユーザー phsplsphspls
提出日時 2022-10-08 11:58:54
言語 Rust
(1.77.0)
結果
AC  
実行時間 275 ms / 2,000 ms
コード長 1,417 bytes
コンパイル時間 1,048 ms
コンパイル使用メモリ 150,276 KB
実行使用メモリ 16,668 KB
最終ジャッジ日時 2023-09-04 14:38:21
合計ジャッジ時間 25,733 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 139 ms
9,516 KB
testcase_04 AC 139 ms
9,448 KB
testcase_05 AC 118 ms
9,464 KB
testcase_06 AC 116 ms
9,452 KB
testcase_07 AC 184 ms
12,616 KB
testcase_08 AC 184 ms
12,636 KB
testcase_09 AC 53 ms
4,856 KB
testcase_10 AC 52 ms
4,872 KB
testcase_11 AC 246 ms
15,128 KB
testcase_12 AC 246 ms
15,144 KB
testcase_13 AC 154 ms
10,420 KB
testcase_14 AC 154 ms
10,440 KB
testcase_15 AC 136 ms
9,376 KB
testcase_16 AC 137 ms
9,392 KB
testcase_17 AC 259 ms
15,776 KB
testcase_18 AC 259 ms
15,884 KB
testcase_19 AC 222 ms
14,132 KB
testcase_20 AC 223 ms
14,064 KB
testcase_21 AC 242 ms
14,828 KB
testcase_22 AC 242 ms
14,828 KB
testcase_23 AC 162 ms
11,212 KB
testcase_24 AC 163 ms
11,228 KB
testcase_25 AC 26 ms
4,380 KB
testcase_26 AC 26 ms
4,380 KB
testcase_27 AC 88 ms
6,604 KB
testcase_28 AC 86 ms
6,596 KB
testcase_29 AC 104 ms
7,692 KB
testcase_30 AC 105 ms
7,760 KB
testcase_31 AC 138 ms
9,632 KB
testcase_32 AC 139 ms
9,700 KB
testcase_33 AC 104 ms
7,612 KB
testcase_34 AC 104 ms
7,688 KB
testcase_35 AC 138 ms
9,508 KB
testcase_36 AC 137 ms
9,508 KB
testcase_37 AC 28 ms
4,380 KB
testcase_38 AC 28 ms
4,380 KB
testcase_39 AC 22 ms
4,380 KB
testcase_40 AC 23 ms
4,376 KB
testcase_41 AC 49 ms
4,632 KB
testcase_42 AC 49 ms
4,700 KB
testcase_43 AC 38 ms
4,376 KB
testcase_44 AC 259 ms
16,056 KB
testcase_45 AC 107 ms
7,792 KB
testcase_46 AC 36 ms
4,380 KB
testcase_47 AC 180 ms
11,640 KB
testcase_48 AC 171 ms
11,492 KB
testcase_49 AC 171 ms
11,704 KB
testcase_50 AC 131 ms
9,344 KB
testcase_51 AC 7 ms
4,380 KB
testcase_52 AC 233 ms
14,504 KB
testcase_53 AC 254 ms
16,648 KB
testcase_54 AC 275 ms
16,652 KB
testcase_55 AC 268 ms
16,628 KB
testcase_56 AC 273 ms
16,636 KB
testcase_57 AC 274 ms
16,664 KB
testcase_58 AC 274 ms
16,660 KB
testcase_59 AC 274 ms
16,584 KB
testcase_60 AC 266 ms
16,648 KB
testcase_61 AC 244 ms
16,656 KB
testcase_62 AC 273 ms
16,588 KB
testcase_63 AC 273 ms
16,624 KB
testcase_64 AC 272 ms
16,616 KB
testcase_65 AC 268 ms
16,612 KB
testcase_66 AC 271 ms
16,648 KB
testcase_67 AC 275 ms
16,580 KB
testcase_68 AC 263 ms
16,584 KB
testcase_69 AC 243 ms
16,660 KB
testcase_70 AC 244 ms
16,640 KB
testcase_71 AC 228 ms
16,624 KB
testcase_72 AC 275 ms
16,652 KB
testcase_73 AC 239 ms
16,584 KB
testcase_74 AC 234 ms
16,632 KB
testcase_75 AC 240 ms
16,664 KB
testcase_76 AC 235 ms
16,604 KB
testcase_77 AC 239 ms
16,668 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: variable `MOD` should have a snake case name
 --> 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
  --> 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];
   |         ~~~~~

warning: 2 warnings emitted

ソースコード

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