結果

問題 No.3039 配信者
ユーザー karinohito
提出日時 2025-03-31 21:28:13
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 211 ms / 2,000 ms
コード長 412 bytes
コンパイル時間 3,157 ms
コンパイル使用メモリ 275,108 KB
実行使用メモリ 10,600 KB
最終ジャッジ日時 2025-03-31 21:28:22
合計ジャッジ時間 6,849 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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<int> P(H+1,0),Q(H+1,0);
	for(int i=0;i<N;i++){
		ll A,B;
		cin>>A>>B;
		P[A]++;
		Q[B]++;
	}
	ll bn=0,an=0;
	for(int t=0;t<=H;t++){
		bn+=P[t];
		an=max(an,bn);
		bn-=Q[t];
	}
	cout<<an<<endl;

}

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

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