結果

問題 No.3039 配信者
ユーザー Facade
提出日時 2025-02-28 21:49:40
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 937 ms / 2,000 ms
コード長 476 bytes
コンパイル時間 3,402 ms
コンパイル使用メモリ 282,592 KB
実行使用メモリ 21,156 KB
最終ジャッジ日時 2025-02-28 21:49:56
合計ジャッジ時間 12,996 ms
ジャッジサーバーID
(参考情報)
judge6 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

#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