結果

問題 No.2154 あさかつの参加人数
ユーザー ixTL255ixTL255
提出日時 2023-03-28 22:20:00
言語 Rust
(1.77.0)
結果
AC  
実行時間 671 ms / 2,000 ms
コード長 687 bytes
コンパイル時間 2,969 ms
コンパイル使用メモリ 161,396 KB
実行使用メモリ 13,508 KB
最終ジャッジ日時 2023-10-20 15:17:36
合計ジャッジ時間 22,352 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 665 ms
13,508 KB
testcase_01 AC 664 ms
13,508 KB
testcase_02 AC 667 ms
13,508 KB
testcase_03 AC 671 ms
13,508 KB
testcase_04 AC 667 ms
13,508 KB
testcase_05 AC 70 ms
7,700 KB
testcase_06 AC 335 ms
10,804 KB
testcase_07 AC 417 ms
8,028 KB
testcase_08 AC 468 ms
7,964 KB
testcase_09 AC 301 ms
4,348 KB
testcase_10 AC 374 ms
7,252 KB
testcase_11 AC 634 ms
12,188 KB
testcase_12 AC 413 ms
9,812 KB
testcase_13 AC 165 ms
6,708 KB
testcase_14 AC 380 ms
10,340 KB
testcase_15 AC 441 ms
7,500 KB
testcase_16 AC 449 ms
10,076 KB
testcase_17 AC 403 ms
11,132 KB
testcase_18 AC 511 ms
11,924 KB
testcase_19 AC 67 ms
4,348 KB
testcase_20 AC 494 ms
10,044 KB
testcase_21 AC 271 ms
4,348 KB
testcase_22 AC 522 ms
5,972 KB
testcase_23 AC 505 ms
11,132 KB
testcase_24 AC 584 ms
12,452 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: variable does not need to be mutable
 --> Main.rs:4:9
  |
4 |     let mut nm: Vec<isize> = s.trim().split_whitespace()
  |         ----^^
  |         |
  |         help: remove this `mut`
  |
  = note: `#[warn(unused_mut)]` on by default

warning: 1 warning emitted

ソースコード

diff #

fn read() -> (isize, isize) {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    let mut nm: Vec<isize> = s.trim().split_whitespace()
        .map(|x| x.parse().unwrap()).collect();
    (nm[0], nm[1])
}

fn main() {
    let (n, m) = read();
    let mut q: Vec<(isize, isize)> = Vec::new();
    for _ in 0..m {
        let (l, r) = read();
        q.push((n - l, n - r));
    }

    let mut mp = vec![0isize; n as usize + 1];
    for &(l, r) in q.iter() {
        mp[l as usize] += 1;
        mp[r as usize + 1] -= 1;
    }
    for i in 0..n as usize {
        mp[i + 1] += mp[i];
    }
    
    for i in 0..n as usize {
        println!("{}", mp[i]);
    }
}
0