結果

問題 No.3039 配信者
ユーザー ooaiu
提出日時 2025-02-28 22:31:35
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 462 ms / 2,000 ms
コード長 556 bytes
コンパイル時間 3,051 ms
コンパイル使用メモリ 281,068 KB
実行使用メモリ 18,684 KB
最終ジャッジ日時 2025-02-28 22:31:45
合計ジャッジ時間 8,484 ms
ジャッジサーバーID
(参考情報)
judge6 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
	std::ios_base::sync_with_stdio(false);
	std::cin.tie(nullptr);
	int N, H;
	cin >> N >> H;
	vector<pair<int, int>> E(N + N);
	for(int i = 0; i < N; i++) {
		int a, b;
		cin >> a >> b;
		E[i] = {a, 1};
		E[i + N] = {b + 1, -1};
	}
	N += N;
	sort(E.begin(), E.end());
	int cnt = 0;
	int ans = 0;
	for(int i = 0; i < E.size(); ) {
		int j = i;
		while(j < E.size() && E[j].first == E[i].first) cnt += E[j].second, j++;
		ans = max(ans, cnt);
		i = j;
	}
	cout << ans << "\n";
}
0