結果
問題 | No.2796 Small Matryoshka |
ユーザー |
|
提出日時 | 2024-06-28 22:52:54 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 226 ms / 2,000 ms |
コード長 | 563 bytes |
コンパイル時間 | 4,688 ms |
コンパイル使用メモリ | 320,292 KB |
実行使用メモリ | 15,872 KB |
最終ジャッジ日時 | 2024-06-28 22:53:07 |
合計ジャッジ時間 | 7,288 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 19 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> using namespace std; using namespace atcoder; using ll=long long; int main() { int n; cin>>n; using pll=pair<ll,ll>; vector<pll> a(n); for(int i=0;i<n;i++)cin>>a[i].second>>a[i].first; sort(a.rbegin(),a.rend()); multiset<ll> s; int ans=-1; for(int i=0;i<n;i++){ auto itr=s.lower_bound(a[i].first); if(itr==s.end()){ ans++; }else{ s.extract(itr); } s.insert(a[i].second); } cout<<ans<<endl; return 0; }