結果
問題 | No.2796 Small Matryoshka |
ユーザー |
|
提出日時 | 2024-06-28 21:24:38 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 116 ms / 2,000 ms |
コード長 | 440 bytes |
コンパイル時間 | 662 ms |
コンパイル使用メモリ | 77,196 KB |
実行使用メモリ | 14,464 KB |
最終ジャッジ日時 | 2024-06-28 21:24:45 |
合計ジャッジ時間 | 2,548 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 19 |
ソースコード
#include<iostream> #include<set> #include<algorithm> #include<cassert> using namespace std; int N; pair<int,int>T[2<<17]; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cin>>N; for(int i=0;i<N;i++) { int a,b;cin>>a>>b; T[i]=make_pair(b,a); } sort(T,T+N); multiset<int>S; for(int i=N;i--;) { auto it=S.lower_bound(T[i].first); if(it!=S.end())S.erase(it); S.insert(T[i].second); } cout<<S.size()-1<<"\n"; }