結果

問題 No.2154 あさかつの参加人数
ユーザー ikepyonikepyon
提出日時 2022-12-27 11:03:43
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,006 ms / 2,000 ms
コード長 2,856 bytes
コンパイル時間 1,778 ms
コンパイル使用メモリ 167,188 KB
実行使用メモリ 9,216 KB
最終ジャッジ日時 2024-05-01 15:55:17
合計ジャッジ時間 22,344 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 994 ms
9,088 KB
testcase_01 AC 991 ms
9,216 KB
testcase_02 AC 1,006 ms
9,088 KB
testcase_03 AC 998 ms
9,088 KB
testcase_04 AC 986 ms
9,088 KB
testcase_05 AC 175 ms
6,144 KB
testcase_06 AC 556 ms
7,680 KB
testcase_07 AC 562 ms
6,272 KB
testcase_08 AC 612 ms
6,400 KB
testcase_09 AC 355 ms
5,376 KB
testcase_10 AC 513 ms
6,016 KB
testcase_11 AC 859 ms
8,320 KB
testcase_12 AC 598 ms
7,168 KB
testcase_13 AC 285 ms
5,632 KB
testcase_14 AC 603 ms
7,424 KB
testcase_15 AC 582 ms
6,144 KB
testcase_16 AC 668 ms
7,552 KB
testcase_17 AC 636 ms
7,808 KB
testcase_18 AC 761 ms
8,192 KB
testcase_19 AC 83 ms
5,376 KB
testcase_20 AC 711 ms
7,296 KB
testcase_21 AC 318 ms
5,376 KB
testcase_22 AC 614 ms
5,376 KB
testcase_23 AC 755 ms
7,808 KB
testcase_24 AC 879 ms
8,448 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#define whole(v) (v).begin(),(v).end()
#define rwhole(v) (v).rbegin(),(v).rend()
#define press(v) (v).erase(unique(whole(v)),(v).end())
#define Yes cout<<"Yes"<<endl; return 0
#define No cout<<"No"<<endl; return 0
#define vint vector<int>
#define vll vector<ll>
#define vpint vector<pair<int,int>>
#define vvint vector<vector<int>>
#define vvll vector<vector<ll>>
#define pqint priority_queue<int>
#define pqpint priority_queue<pair<int,int>>
#define rpqint priority_queue<int,vector<int>,greater<int>>
#define rpqpint priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>>
using namespace std;
using ll = long long;
int mod107 = 1000000007, mod998 = 998244353;
string alphabet = "abcdefghijklmnopqrstuvwxyz", ALFHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

//(a,b)と(c,d)の距離
double pyth(ll a, ll b, ll c, ll d) {
    double l = sqrt((a - c) * (a - c) + (b - d) * (b - d));
    return l;
}

//aのb乗をmで割った余り(a,bは非負整数,mは自然数)
int power(ll a, ll b, int m) {
    int k = 0, ans = 1;
    vector<ll> v(100);
    v[0] = a;
    for (int i = 1; i < 100; i++)
        v[i] = v[i - 1] * v[i - 1] % m;
    while (b > 0) {
        if (b % 2)
            ans = ans * v[k] % m;
        k++; b /= 2;
    }
    return ans;
}

//素数判定 O(sqrt(n))
bool prime_judge(ll n) {
    for (int i = 2; i <= sqrt(n); i++) {
        if (n % i == 0) {
            return false;
        }
    }
    return true;
}

int main() {
    int n, m;
    cin >> n >> m;
    vint l(m), r(m), ans(n + 2);

    for (int i = 0; i < m; i++) {
        cin >> l[i] >> r[i];
        ans[l[i]]++;
        ans[r[i] - 1]--;
    }

    for (int i = n; i > 0; i--) {
        ans[i] += ans[i + 1];
        cout << ans[i] << endl;
    }
}
0