結果

問題 No.3039 配信者
ユーザー karinohito
提出日時 2025-03-31 21:26:34
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 475 ms / 2,000 ms
コード長 437 bytes
コンパイル時間 4,128 ms
コンパイル使用メモリ 282,848 KB
実行使用メモリ 37,412 KB
最終ジャッジ日時 2025-03-31 21:26:46
合計ジャッジ時間 11,339 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

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

void solve(){
	ll N,H;cin>>N>>H;
	vector<pair<ll,ll>> P;
	for(int i=0;i<N;i++){
		ll A,B;
		cin>>A>>B;
		P.push_back({A,-1});
		P.push_back({B,1});
	}
	sort(P.begin(),P.end());
	ll bn=0,an=0;
	for(auto [p,k]:P){
		bn+=k;
		an=min(an,bn);
	}
	cout<<-an<<endl;

}

int main(){
	
	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int T=1;
	// cin>>T;
	while(T--)solve();
}
0