結果

問題 No.479 頂点は要らない
ユーザー phsplsphspls
提出日時 2022-12-21 01:30:05
言語 Rust
(1.77.0)
結果
AC  
実行時間 31 ms / 1,500 ms
コード長 932 bytes
コンパイル時間 10,339 ms
コンパイル使用メモリ 405,276 KB
実行使用メモリ 11,520 KB
最終ジャッジ日時 2024-04-29 03:06:57
合計ジャッジ時間 12,561 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 0 ms
5,376 KB
testcase_04 AC 0 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 0 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 AC 1 ms
5,376 KB
testcase_15 AC 1 ms
5,376 KB
testcase_16 AC 0 ms
5,376 KB
testcase_17 AC 1 ms
5,376 KB
testcase_18 AC 1 ms
5,376 KB
testcase_19 AC 1 ms
5,376 KB
testcase_20 AC 1 ms
5,376 KB
testcase_21 AC 1 ms
5,376 KB
testcase_22 AC 1 ms
5,376 KB
testcase_23 AC 1 ms
5,376 KB
testcase_24 AC 1 ms
5,376 KB
testcase_25 AC 1 ms
5,376 KB
testcase_26 AC 31 ms
10,624 KB
testcase_27 AC 29 ms
10,624 KB
testcase_28 AC 25 ms
11,520 KB
testcase_29 AC 25 ms
6,912 KB
testcase_30 AC 23 ms
6,944 KB
testcase_31 AC 22 ms
6,912 KB
testcase_32 AC 22 ms
6,912 KB
testcase_33 AC 23 ms
7,296 KB
testcase_34 AC 25 ms
7,424 KB
testcase_35 AC 25 ms
5,504 KB
testcase_36 AC 14 ms
5,376 KB
testcase_37 AC 26 ms
7,936 KB
testcase_38 AC 20 ms
6,528 KB
testcase_39 AC 15 ms
5,888 KB
testcase_40 AC 18 ms
7,424 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

fn main() {
    let mut nm = String::new();
    std::io::stdin().read_line(&mut nm).ok();
    let nm: Vec<usize> = nm.trim().split_whitespace().map(|s| s.parse().unwrap()).collect();
    let n = nm[0];
    let m = nm[1];
    let mut paths = vec![vec![]; n];
    for _ in 0..m {
        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();
        let a = temp[0];
        let b = temp[1];
        paths[a].push(b);
        paths[b].push(a);
    }

    let mut used = vec![false; n];
    for i in (0..n).rev() {
        if used[i] { continue; }
        for &v in paths[i].iter() {
            if used[v] || v > i { continue; }
            used[v] = true;
        }
    }
    println!("{}", (0..n).rev().skip_while(|&i| !used[i]).map(|i| if used[i] { "1" } else { "0" }).collect::<Vec<_>>().join(""));
}
0