結果

問題 No.2796 Small Matryoshka
ユーザー kokosei
提出日時 2024-07-06 09:38:43
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 74 ms / 2,000 ms
コード長 537 bytes
コンパイル時間 1,063 ms
コンパイル使用メモリ 100,724 KB
実行使用メモリ 7,524 KB
最終ジャッジ日時 2024-07-06 09:38:56
合計ジャッジ時間 2,749 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long;

int N;
int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    cin >> N;
    vector<pair<int, int>> A;
    for(int i = 0;i < N;i++){
        int l, r; cin >> l >> r;
        A.push_back({l, 1});
        A.push_back({r, -1});
    }
    sort(A.begin(), A.end());
    int cnt = 0, ans = 0;
    for(auto [x, t] : A){
        cnt += t;
        ans = max(ans, cnt);
    }
    cout << ans - 1 << endl;
    return 0;
}
0