結果

問題 No.433 ICPC国内予選の選抜ルールがこんな感じだったらうれしい
ユーザー phsplsphspls
提出日時 2023-01-27 00:33:53
言語 Rust
(1.77.0)
結果
AC  
実行時間 125 ms / 4,000 ms
コード長 1,102 bytes
コンパイル時間 6,473 ms
コンパイル使用メモリ 150,836 KB
実行使用メモリ 12,792 KB
最終ジャッジ日時 2023-09-09 22:06:11
合計ジャッジ時間 10,040 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 113 ms
12,644 KB
testcase_01 AC 93 ms
12,756 KB
testcase_02 AC 49 ms
11,596 KB
testcase_03 AC 85 ms
11,304 KB
testcase_04 AC 88 ms
11,348 KB
testcase_05 AC 69 ms
11,696 KB
testcase_06 AC 125 ms
12,792 KB
testcase_07 AC 61 ms
12,664 KB
testcase_08 AC 51 ms
12,016 KB
testcase_09 AC 68 ms
11,344 KB
testcase_10 AC 80 ms
11,224 KB
testcase_11 AC 99 ms
10,972 KB
testcase_12 AC 93 ms
11,076 KB
testcase_13 AC 53 ms
11,304 KB
testcase_14 AC 72 ms
11,216 KB
testcase_15 AC 47 ms
10,816 KB
testcase_16 AC 111 ms
11,008 KB
testcase_17 AC 110 ms
11,412 KB
testcase_18 AC 114 ms
11,332 KB
testcase_19 AC 51 ms
11,228 KB
testcase_20 AC 64 ms
11,188 KB
testcase_21 AC 58 ms
11,252 KB
testcase_22 AC 94 ms
11,160 KB
testcase_23 AC 74 ms
11,288 KB
testcase_24 AC 49 ms
11,152 KB
testcase_25 AC 86 ms
11,156 KB
testcase_26 AC 63 ms
10,952 KB
testcase_27 AC 87 ms
10,892 KB
testcase_28 AC 48 ms
11,352 KB
testcase_29 AC 98 ms
11,044 KB
testcase_30 AC 4 ms
4,380 KB
testcase_31 AC 3 ms
4,376 KB
testcase_32 AC 105 ms
11,452 KB
testcase_33 AC 114 ms
11,040 KB
testcase_34 AC 54 ms
11,332 KB
testcase_35 AC 4 ms
4,380 KB
testcase_36 AC 3 ms
4,380 KB
testcase_37 AC 4 ms
4,376 KB
testcase_38 AC 4 ms
4,376 KB
testcase_39 AC 4 ms
4,380 KB
testcase_40 AC 4 ms
4,376 KB
testcase_41 AC 9 ms
5,052 KB
testcase_42 AC 9 ms
5,000 KB
testcase_43 AC 9 ms
5,060 KB
testcase_44 AC 9 ms
5,012 KB
testcase_45 AC 5 ms
4,380 KB
testcase_46 AC 22 ms
4,992 KB
testcase_47 AC 20 ms
5,052 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: unused variable: `s`
  --> Main.rs:20:14
   |
20 |         let (s, p, u) = items[i];
   |              ^ help: if this is intentional, prefix it with an underscore: `_s`
   |
   = note: `#[warn(unused_variables)]` on by default

warning: unused variable: `p`
  --> Main.rs:20:17
   |
20 |         let (s, p, u) = items[i];
   |                 ^ help: if this is intentional, prefix it with an underscore: `_p`

warning: 2 warnings emitted

ソースコード

diff #

use std::{collections::BinaryHeap, cmp::Reverse};


fn main() {
    let mut nk = String::new();
    std::io::stdin().read_line(&mut nk).ok();
    let nk: Vec<usize> = nk.trim().split_whitespace().map(|s| s.parse().unwrap()).collect();
    let n = nk[0];
    let k = nk[1];
    let items = (0..n).map(|_| {
            let mut temp = String::new();
            std::io::stdin().read_line(&mut temp).ok();
            let temp: Vec<usize> = temp.trim().split_whitespace().map(|s| s.parse().unwrap()).collect();
            (temp[0], temp[1], temp[2]-1)
        })
        .collect::<Vec<_>>();

    let mut mapping = vec![vec![]; 100000];
    for i in 0..n {
        let (s, p, u) = items[i];
        mapping[u].push(i);
    }
    let mut pque = BinaryHeap::new();
    for i in 0..100000 {
        mapping[i].sort_by_key(|&i| (Reverse(items[i].0), items[i].1));
        for (idx, &j) in mapping[i].iter().enumerate() {
            let (s, p, _) = items[j];
            pque.push((s, Reverse(idx), Reverse(p), j));
        }
    }
    for _ in 0..k {
        println!("{}", pque.pop().unwrap().3);
    }
}
0