結果
問題 | No.2796 Small Matryoshka |
ユーザー |
|
提出日時 | 2024-06-28 21:29:35 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 157 ms / 2,000 ms |
コード長 | 480 bytes |
コンパイル時間 | 2,455 ms |
コンパイル使用メモリ | 205,900 KB |
最終ジャッジ日時 | 2025-02-22 00:55:36 |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 19 |
ソースコード
#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; }