結果

問題 No.433 ICPC国内予選の選抜ルールがこんな感じだったらうれしい
ユーザー phsplsphspls
提出日時 2023-02-10 01:13:47
言語 Rust
(1.77.0)
結果
AC  
実行時間 128 ms / 4,000 ms
コード長 1,088 bytes
コンパイル時間 1,196 ms
コンパイル使用メモリ 149,716 KB
実行使用メモリ 12,816 KB
最終ジャッジ日時 2023-09-21 06:42:35
合計ジャッジ時間 7,939 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 115 ms
12,660 KB
testcase_01 AC 96 ms
12,700 KB
testcase_02 AC 51 ms
11,628 KB
testcase_03 AC 90 ms
11,276 KB
testcase_04 AC 90 ms
11,352 KB
testcase_05 AC 70 ms
11,756 KB
testcase_06 AC 128 ms
12,816 KB
testcase_07 AC 61 ms
12,680 KB
testcase_08 AC 52 ms
12,016 KB
testcase_09 AC 69 ms
11,256 KB
testcase_10 AC 83 ms
11,228 KB
testcase_11 AC 101 ms
10,924 KB
testcase_12 AC 92 ms
11,084 KB
testcase_13 AC 52 ms
11,328 KB
testcase_14 AC 71 ms
11,208 KB
testcase_15 AC 46 ms
10,820 KB
testcase_16 AC 115 ms
10,952 KB
testcase_17 AC 111 ms
11,384 KB
testcase_18 AC 114 ms
11,356 KB
testcase_19 AC 52 ms
11,200 KB
testcase_20 AC 63 ms
11,156 KB
testcase_21 AC 59 ms
11,156 KB
testcase_22 AC 95 ms
11,048 KB
testcase_23 AC 73 ms
11,268 KB
testcase_24 AC 50 ms
11,132 KB
testcase_25 AC 88 ms
11,136 KB
testcase_26 AC 65 ms
10,996 KB
testcase_27 AC 88 ms
10,880 KB
testcase_28 AC 49 ms
11,324 KB
testcase_29 AC 98 ms
11,136 KB
testcase_30 AC 3 ms
4,380 KB
testcase_31 AC 3 ms
4,376 KB
testcase_32 AC 108 ms
11,492 KB
testcase_33 AC 114 ms
11,032 KB
testcase_34 AC 57 ms
11,364 KB
testcase_35 AC 3 ms
4,376 KB
testcase_36 AC 3 ms
4,376 KB
testcase_37 AC 4 ms
4,376 KB
testcase_38 AC 3 ms
4,380 KB
testcase_39 AC 4 ms
4,380 KB
testcase_40 AC 4 ms
4,376 KB
testcase_41 AC 9 ms
5,000 KB
testcase_42 AC 9 ms
5,060 KB
testcase_43 AC 8 ms
4,932 KB
testcase_44 AC 9 ms
5,020 KB
testcase_45 AC 5 ms
4,376 KB
testcase_46 AC 22 ms
5,000 KB
testcase_47 AC 22 ms
5,032 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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


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 univs = vec![vec![]; 100000];
    for i in 0..n {
        univs[items[i].2].push(i);
    }
    let mut pque = BinaryHeap::new();
    for i in 0..100000 {
        univs[i].sort_by_key(|&j| (Reverse(items[j].0), items[j].1));
        for j in 0..univs[i].len() {
            let idx = univs[i][j];
            let (s, p, _) = items[idx];
            pque.push((s, Reverse(j), Reverse(p), idx));
        }
    }
    for _ in 0..k {
        println!("{}", pque.pop().unwrap().3);
    }
}
0