結果

問題 No.2154 あさかつの参加人数
ユーザー kpinkcatkpinkcat
提出日時 2023-09-24 13:23:23
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 746 ms / 2,000 ms
コード長 647 bytes
コンパイル時間 3,596 ms
コンパイル使用メモリ 199,172 KB
実行使用メモリ 10,912 KB
最終ジャッジ日時 2023-09-24 13:23:45
合計ジャッジ時間 21,436 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 724 ms
10,784 KB
testcase_01 AC 735 ms
10,892 KB
testcase_02 AC 734 ms
10,684 KB
testcase_03 AC 718 ms
10,912 KB
testcase_04 AC 746 ms
10,712 KB
testcase_05 AC 60 ms
4,360 KB
testcase_06 AC 356 ms
6,156 KB
testcase_07 AC 459 ms
8,072 KB
testcase_08 AC 494 ms
8,644 KB
testcase_09 AC 338 ms
7,152 KB
testcase_10 AC 395 ms
7,528 KB
testcase_11 AC 625 ms
9,984 KB
testcase_12 AC 425 ms
7,440 KB
testcase_13 AC 179 ms
4,532 KB
testcase_14 AC 418 ms
7,252 KB
testcase_15 AC 473 ms
8,720 KB
testcase_16 AC 473 ms
8,268 KB
testcase_17 AC 437 ms
7,232 KB
testcase_18 AC 553 ms
8,728 KB
testcase_19 AC 69 ms
4,360 KB
testcase_20 AC 561 ms
9,084 KB
testcase_21 AC 293 ms
6,804 KB
testcase_22 AC 585 ms
10,312 KB
testcase_23 AC 546 ms
8,788 KB
testcase_24 AC 657 ms
9,628 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include<iostream>
#include<map>
#include<vector>
#include <algorithm>
#include<math.h>
#include <iomanip>
#include<set>
#include <numeric>
#include<string>
using ll = long long;
using namespace std;


int main()
{
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    
    ll n, m;
    cin >> n >> m;
    vector<ll> d(n), sum(n);
    for (int i = 0; i < m; i++){
        int be, end;
        cin >> be >> end;
        d[n-be]++;
        if (end != 1) d[n- end + 1]--;
    }
    for (int i = 0; i < n; i++){
        sum[i] += d[i];
        if (i) sum[i] += sum[i-1];
        cout << sum[i] << endl;
    }
}
0