結果

問題 No.2796 Small Matryoshka
ユーザー GOTKAKOGOTKAKO
提出日時 2024-06-28 21:29:35
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 133 ms / 2,000 ms
コード長 480 bytes
コンパイル時間 2,011 ms
コンパイル使用メモリ 213,676 KB
実行使用メモリ 15,740 KB
最終ジャッジ日時 2024-06-28 21:30:47
合計ジャッジ時間 3,859 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 1 ms
6,944 KB
testcase_05 AC 11 ms
6,940 KB
testcase_06 AC 56 ms
6,944 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 43 ms
6,944 KB
testcase_09 AC 133 ms
15,628 KB
testcase_10 AC 118 ms
15,576 KB
testcase_11 AC 129 ms
15,740 KB
testcase_12 AC 35 ms
6,944 KB
testcase_13 AC 5 ms
6,940 KB
testcase_14 AC 35 ms
6,944 KB
testcase_15 AC 9 ms
6,940 KB
testcase_16 AC 15 ms
6,944 KB
testcase_17 AC 65 ms
7,808 KB
testcase_18 AC 74 ms
8,576 KB
testcase_19 AC 21 ms
6,944 KB
testcase_20 AC 30 ms
6,940 KB
testcase_21 AC 63 ms
7,936 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

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

    int N; cin >> N;
    vector<pair<long long,long long>> rR(N);
    for(auto &[r,R] : rR) cin >> r >> R;
    sort(rR.rbegin(),rR.rend());

    multiset<long long> S;
    for(auto &[r,R] : rR){
        auto itr = S.lower_bound(R);
        if(itr == S.end()) S.insert(r);
        else S.erase(itr),S.insert(r);
        
    }
    cout << S.size()-1 << endl;
}
0