結果

問題 No.433 ICPC国内予選の選抜ルールがこんな感じだったらうれしい
ユーザー phsplsphspls
提出日時 2023-01-14 03:24:09
言語 Rust
(1.77.0)
結果
AC  
実行時間 110 ms / 4,000 ms
コード長 1,255 bytes
コンパイル時間 2,594 ms
コンパイル使用メモリ 149,012 KB
実行使用メモリ 12,828 KB
最終ジャッジ日時 2023-08-26 07:42:07
合計ジャッジ時間 7,893 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 101 ms
12,684 KB
testcase_01 AC 79 ms
12,796 KB
testcase_02 AC 43 ms
11,676 KB
testcase_03 AC 73 ms
11,332 KB
testcase_04 AC 80 ms
11,392 KB
testcase_05 AC 59 ms
11,736 KB
testcase_06 AC 110 ms
12,828 KB
testcase_07 AC 54 ms
12,704 KB
testcase_08 AC 45 ms
12,056 KB
testcase_09 AC 59 ms
11,376 KB
testcase_10 AC 72 ms
11,276 KB
testcase_11 AC 88 ms
10,944 KB
testcase_12 AC 83 ms
11,172 KB
testcase_13 AC 46 ms
11,288 KB
testcase_14 AC 65 ms
11,148 KB
testcase_15 AC 42 ms
10,864 KB
testcase_16 AC 104 ms
10,980 KB
testcase_17 AC 99 ms
11,376 KB
testcase_18 AC 101 ms
11,380 KB
testcase_19 AC 45 ms
11,252 KB
testcase_20 AC 55 ms
11,220 KB
testcase_21 AC 52 ms
11,216 KB
testcase_22 AC 87 ms
11,124 KB
testcase_23 AC 66 ms
11,296 KB
testcase_24 AC 44 ms
11,124 KB
testcase_25 AC 80 ms
11,116 KB
testcase_26 AC 59 ms
11,052 KB
testcase_27 AC 82 ms
10,852 KB
testcase_28 AC 47 ms
11,372 KB
testcase_29 AC 87 ms
11,108 KB
testcase_30 AC 3 ms
4,380 KB
testcase_31 AC 3 ms
4,380 KB
testcase_32 AC 94 ms
11,500 KB
testcase_33 AC 102 ms
10,996 KB
testcase_34 AC 49 ms
11,332 KB
testcase_35 AC 3 ms
4,380 KB
testcase_36 AC 3 ms
4,376 KB
testcase_37 AC 3 ms
4,380 KB
testcase_38 AC 3 ms
4,380 KB
testcase_39 AC 3 ms
4,380 KB
testcase_40 AC 4 ms
4,376 KB
testcase_41 AC 7 ms
5,020 KB
testcase_42 AC 7 ms
5,060 KB
testcase_43 AC 8 ms
5,080 KB
testcase_44 AC 6 ms
5,064 KB
testcase_45 AC 5 ms
4,376 KB
testcase_46 AC 19 ms
5,024 KB
testcase_47 AC 18 ms
5,076 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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


const LIMIT: usize = 1e5 as usize;

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 teams = (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 orders = vec![vec![]; LIMIT];
    for i in 0..n {
        let (_, _, u) = teams[i];
        orders[u].push(i);
    }
    for i in 0..LIMIT {
        orders[i].sort_by_key(|&j| (Reverse(teams[j].0), teams[j].1));
    }
    let mut pque = BinaryHeap::new();
    for v in orders.iter() {
        let limit = v.len();
        for i in 0..limit {
            let team_idx = v[i];
            let (s, p, _) = teams[team_idx];
            pque.push((s, Reverse(i), Reverse(p), team_idx));
        }
    }
    for _ in 0..k {
        let (_, _, _, team_idx) = pque.pop().unwrap();
        println!("{}", team_idx);
    }
}
0