結果
| 問題 |
No.3039 配信者
|
| ユーザー |
Mogobon
|
| 提出日時 | 2025-03-03 18:40:00 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 887 ms / 2,000 ms |
| コード長 | 680 bytes |
| コンパイル時間 | 1,136 ms |
| コンパイル使用メモリ | 105,576 KB |
| 実行使用メモリ | 21,544 KB |
| 最終ジャッジ日時 | 2025-03-03 18:40:11 |
| 合計ジャッジ時間 | 10,643 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 15 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int N, H;
cin >> N >> H;
vector<pair<int, int>> lst;
// 入力処理
for (int i = 0; i < N; i++) {
int a, b;
cin >> a >> b;
lst.emplace_back(a, 1); // 配信開始 (+1)
lst.emplace_back(b + 1, -1); // 配信終了 (-1)
}
// 時刻順にソート
sort(lst.begin(), lst.end());
// スイープライン処理
int ans = 0, temp = 0;
for (const auto& [_, sgn] : lst) {
temp += sgn;
ans = max(ans, temp);
}
// 最大同時視聴数を出力
cout << ans << endl;
return 0;
}
Mogobon