結果

問題 No.2154 あさかつの参加人数
ユーザー phsplsphspls
提出日時 2022-12-20 00:53:47
言語 Rust
(1.77.0)
結果
AC  
実行時間 761 ms / 2,000 ms
コード長 813 bytes
コンパイル時間 13,063 ms
コンパイル使用メモリ 380,372 KB
実行使用メモリ 13,696 KB
最終ジャッジ日時 2024-04-29 02:38:46
合計ジャッジ時間 30,459 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 744 ms
13,568 KB
testcase_01 AC 760 ms
13,568 KB
testcase_02 AC 761 ms
13,696 KB
testcase_03 AC 752 ms
13,576 KB
testcase_04 AC 740 ms
13,568 KB
testcase_05 AC 67 ms
7,552 KB
testcase_06 AC 357 ms
10,752 KB
testcase_07 AC 452 ms
7,936 KB
testcase_08 AC 513 ms
7,884 KB
testcase_09 AC 333 ms
5,376 KB
testcase_10 AC 414 ms
7,416 KB
testcase_11 AC 658 ms
12,032 KB
testcase_12 AC 443 ms
9,752 KB
testcase_13 AC 187 ms
6,784 KB
testcase_14 AC 429 ms
10,368 KB
testcase_15 AC 480 ms
7,552 KB
testcase_16 AC 510 ms
10,200 KB
testcase_17 AC 435 ms
11,008 KB
testcase_18 AC 551 ms
11,792 KB
testcase_19 AC 72 ms
5,376 KB
testcase_20 AC 556 ms
10,112 KB
testcase_21 AC 299 ms
5,376 KB
testcase_22 AC 600 ms
6,016 KB
testcase_23 AC 556 ms
11,196 KB
testcase_24 AC 651 ms
12,416 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

fn main() {
    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 n = temp[0];
    let m = temp[1];
    let queries = (0..m).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();
            (n - temp[0], n - temp[1])
        })
        .collect::<Vec<_>>();

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