結果

問題 No.1557 Binary Variable
ユーザー phsplsphspls
提出日時 2022-10-28 10:50:43
言語 Rust
(1.77.0)
結果
AC  
実行時間 62 ms / 2,000 ms
コード長 769 bytes
コンパイル時間 2,599 ms
コンパイル使用メモリ 149,540 KB
実行使用メモリ 6,596 KB
最終ジャッジ日時 2023-09-19 04:14:27
合計ジャッジ時間 7,669 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
5,128 KB
testcase_01 AC 43 ms
5,124 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 48 ms
6,172 KB
testcase_05 AC 47 ms
6,580 KB
testcase_06 AC 45 ms
6,052 KB
testcase_07 AC 46 ms
6,088 KB
testcase_08 AC 51 ms
6,320 KB
testcase_09 AC 53 ms
6,596 KB
testcase_10 AC 59 ms
6,324 KB
testcase_11 AC 58 ms
6,304 KB
testcase_12 AC 51 ms
6,376 KB
testcase_13 AC 58 ms
6,244 KB
testcase_14 AC 58 ms
6,400 KB
testcase_15 AC 58 ms
6,308 KB
testcase_16 AC 59 ms
6,412 KB
testcase_17 AC 57 ms
6,316 KB
testcase_18 AC 57 ms
6,344 KB
testcase_19 AC 59 ms
6,300 KB
testcase_20 AC 59 ms
6,380 KB
testcase_21 AC 60 ms
6,424 KB
testcase_22 AC 59 ms
6,380 KB
testcase_23 AC 58 ms
6,320 KB
testcase_24 AC 59 ms
6,308 KB
testcase_25 AC 59 ms
6,352 KB
testcase_26 AC 60 ms
6,352 KB
testcase_27 AC 60 ms
6,336 KB
testcase_28 AC 60 ms
6,348 KB
testcase_29 AC 61 ms
6,312 KB
testcase_30 AC 62 ms
6,356 KB
testcase_31 AC 62 ms
6,396 KB
testcase_32 AC 61 ms
6,320 KB
testcase_33 AC 59 ms
6,328 KB
testcase_34 AC 1 ms
4,380 KB
testcase_35 AC 1 ms
4,376 KB
testcase_36 AC 1 ms
4,388 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 pairs = (0..m).map(|_| {
            let mut temp = String::new();
            std::io::stdin().read_line(&mut temp).ok();
            let temp: Vec<isize> = temp.trim().split_whitespace().map(|s| s.parse().unwrap()).collect();
            (temp[0]-1, temp[1]-1)
        })
        .collect::<Vec<_>>();

    pairs.sort_by_key(|&(_, y)| y);
    let mut cur = -1;
    let mut result = 0usize;
    for &(l, r) in pairs.iter() {
        if cur >= l { continue; }
        result += 1;
        cur = r;
    }
    println!("{}", n-result);
}
0