結果

問題 No.2154 あさかつの参加人数
ユーザー kpinkcatkpinkcat
提出日時 2023-09-24 13:23:23
言語 C++17(gcc12)
(gcc 12.3.0 + boost 1.87.0)
結果
AC  
実行時間 794 ms / 2,000 ms
コード長 647 bytes
コンパイル時間 2,194 ms
コンパイル使用メモリ 201,964 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-07-17 14:14:22
合計ジャッジ時間 19,773 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

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