結果

問題 No.3039 配信者
コンテスト
ユーザー Facade
提出日時 2025-02-28 21:49:40
言語 C++23
(gcc 15.2.0 + boost 1.90.0)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 553 ms / 2,000 ms
コード長 476 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,141 ms
コンパイル使用メモリ 339,864 KB
実行使用メモリ 20,292 KB
最終ジャッジ日時 2026-07-06 12:12:53
合計ジャッジ時間 9,107 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;

int main(){
    int n,h;cin>>n>>h;
    vector<pair<int,int>>time;
    for(int i=0;i<n;i++){
        int a,b;cin>>a>>b;
        time.push_back({a,1});
        time.push_back({b+1,0});
    }
    sort(time.begin(),time.end());
    int ans=0;
    int cnt=0;
    for(auto [i,j] :time){
        if(j==1){
            cnt++;
            ans=max(ans,cnt);
        }
        else{
            cnt--;
        }
    }
    cout<<ans<<endl;
}
0