結果

問題 No.2154 あさかつの参加人数
ユーザー Carpenters-CatCarpenters-Cat
提出日時 2022-12-09 21:42:17
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,075 ms / 2,000 ms
コード長 430 bytes
コンパイル時間 2,379 ms
コンパイル使用メモリ 195,720 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-22 21:27:40
合計ジャッジ時間 24,462 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,070 ms
5,248 KB
testcase_01 AC 1,075 ms
5,376 KB
testcase_02 AC 1,060 ms
5,376 KB
testcase_03 AC 1,055 ms
5,376 KB
testcase_04 AC 1,061 ms
5,376 KB
testcase_05 AC 175 ms
5,376 KB
testcase_06 AC 585 ms
5,376 KB
testcase_07 AC 596 ms
5,376 KB
testcase_08 AC 648 ms
5,376 KB
testcase_09 AC 365 ms
5,376 KB
testcase_10 AC 533 ms
5,376 KB
testcase_11 AC 920 ms
5,376 KB
testcase_12 AC 645 ms
5,376 KB
testcase_13 AC 289 ms
5,376 KB
testcase_14 AC 640 ms
5,376 KB
testcase_15 AC 600 ms
5,376 KB
testcase_16 AC 703 ms
5,376 KB
testcase_17 AC 673 ms
5,376 KB
testcase_18 AC 803 ms
5,376 KB
testcase_19 AC 87 ms
5,376 KB
testcase_20 AC 742 ms
5,376 KB
testcase_21 AC 329 ms
5,376 KB
testcase_22 AC 634 ms
5,376 KB
testcase_23 AC 791 ms
5,376 KB
testcase_24 AC 921 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main () {
    int N, M;
    cin >> N >> M;
    std::vector<int> A(N, 0);
    for (int i = 0; i < M; i ++) {
        int l, r;
        cin >> l >> r;
        A[l - 1] ++;
        if (r > 1) {
            A[r - 2] --;
        }
    }
    for (int i = N - 1; i > 0; i --) {
        A[i - 1] += A[i];
    }
    for (int i = N - 1; i >= 0; i --) {
        cout << A[i] << endl;
    }
}
0