結果

問題 No.748 yuki国のお財布事情
ユーザー 特命ログイン特命ログイン
提出日時 2018-10-19 23:08:18
言語 Rust
(1.77.0)
結果
WA  
実行時間 -
コード長 991 bytes
コンパイル時間 14,591 ms
コンパイル使用メモリ 378,860 KB
実行使用メモリ 17,152 KB
最終ジャッジ日時 2024-04-29 16:52:46
合計ジャッジ時間 16,527 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 1 ms
5,376 KB
testcase_03 WA -
testcase_04 AC 0 ms
5,376 KB
testcase_05 WA -
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 WA -
testcase_11 AC 1 ms
5,376 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 1 ms
5,376 KB
testcase_23 WA -
testcase_24 AC 0 ms
5,376 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 30 ms
11,520 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::io::{Read,stdin};

fn main() {
    let mut buf = String::new();
    stdin().read_to_string(&mut buf).unwrap();
    let mut tok = buf.split_whitespace();
    let mut get = || tok.next().unwrap();
    macro_rules! get {
        ($t:ty) => (get().parse::<$t>().unwrap());
        () => (get!(i64));
    }
    
    // たぶん MST だと思うけど、面倒になった
    
    let n = get!(usize);
    let m = get!();
    let k = get!();
    
    let mut graph = vec![vec![]; n];
    let mut road = vec![];
    let mut total = 0;
    for _ in 0..m {
        let a = get!(usize)-1;
        let b = get!(usize)-1;
        let c = get!();
        graph[a].push((c, b));
        graph[b].push((c, a));
        road.push((a, b, c));
        total += c;
    }
    let mut flag = vec![false; n];
    for _ in 0..k {
        let e = get!(usize) - 1;
        let (a, b, c) = road[e];
        total -= c;
        flag[a] = true;
        flag[b] = true;
    }
    
    println!("{}", total);
}
0