結果
問題 |
No.3039 配信者
|
ユーザー |
|
提出日時 | 2025-03-02 11:56:56 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 416 ms / 2,000 ms |
コード長 | 870 bytes |
コンパイル時間 | 1,290 ms |
コンパイル使用メモリ | 121,516 KB |
実行使用メモリ | 13,172 KB |
最終ジャッジ日時 | 2025-03-02 11:57:03 |
合計ジャッジ時間 | 6,803 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 15 |
ソースコード
#include <iostream> #include <cstdint> #include <vector> #include <algorithm> #include <queue> #include <functional> using namespace std; template<typename T> constexpr T chmax(T& variable, const T value) noexcept { if (variable < value) return (variable = value); else return variable; } int main() { cin.tie(nullptr); ios::sync_with_stdio(false); uint32_t N, H, i; cin >> N >> H; vector<pair<uint32_t, uint32_t>> stream_time(N); for (i = 0; i != N; ++i) cin >> stream_time[i].first >> stream_time[i].second; uint32_t ans = 0; priority_queue<uint32_t, vector<uint32_t>, greater<uint32_t>> pq; pq.push(UINT32_MAX); sort(stream_time.begin(), stream_time.end()); for (i = 0; i != N; ++i) { while (pq.top() < stream_time[i].first) pq.pop(); pq.push(stream_time[i].second); chmax<uint32_t>(ans, pq.size() - 1); } cout << ans << '\n'; return 0; }