結果

問題 No.2154 あさかつの参加人数
ユーザー lddlinanlddlinan
提出日時 2023-03-17 16:12:33
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 300 ms / 2,000 ms
コード長 950 bytes
コンパイル時間 720 ms
コンパイル使用メモリ 87,456 KB
実行使用メモリ 11,016 KB
最終ジャッジ日時 2023-10-18 13:43:31
合計ジャッジ時間 14,497 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 300 ms
11,016 KB
testcase_01 AC 299 ms
11,016 KB
testcase_02 AC 297 ms
11,016 KB
testcase_03 AC 300 ms
11,016 KB
testcase_04 AC 297 ms
11,016 KB
testcase_05 AC 154 ms
8,944 KB
testcase_06 AC 252 ms
10,484 KB
testcase_07 AC 142 ms
6,820 KB
testcase_08 AC 135 ms
6,352 KB
testcase_09 AC 34 ms
4,348 KB
testcase_10 AC 126 ms
6,412 KB
testcase_11 AC 255 ms
9,940 KB
testcase_12 AC 204 ms
8,820 KB
testcase_13 AC 130 ms
7,128 KB
testcase_14 AC 229 ms
9,612 KB
testcase_15 AC 123 ms
6,128 KB
testcase_16 AC 214 ms
8,936 KB
testcase_17 AC 258 ms
10,392 KB
testcase_18 AC 262 ms
10,344 KB
testcase_19 AC 16 ms
4,372 KB
testcase_20 AC 200 ms
8,440 KB
testcase_21 AC 28 ms
4,372 KB
testcase_22 AC 56 ms
4,372 KB
testcase_23 AC 240 ms
9,696 KB
testcase_24 AC 268 ms
10,320 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include <map>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <algorithm>
#include <array>
#include <unordered_set>
#include <unordered_map>
#include <string>
using namespace std;

bool rcmp(int a, int b) { return a>b; }
typedef long long LL;



typedef struct { int i, x; } RNode;
RNode rs[1000004];
bool mycmp(const RNode& a, const RNode& b) {
    if (a.i!=b.i) return a.i<b.i;
    return a.x<b.x;
}
int main() {
    int n, i, m, k, l, r, j, c;
    scanf("%d %d", &n, &m);
    k=0;
    for (i=0; i<m; i++) {
        scanf("%d %d", &l, &r);
        l=n-l+1; r=n-r+1;
        rs[k].i=l; rs[k].x=1; k++;
        rs[k].i=r+1; rs[k].x=-1; k++;
    }
    sort(rs, rs+k, mycmp);
    c=0;
    for (i=0, j=1; j<=n; j++) {
        while(i<k&&rs[i].i==j) {
            c+=rs[i].x;
            i++;
        }
        printf("%d\n", c);
    }
    return 0;
}
0