結果
| 問題 |
No.2796 Small Matryoshka
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-06-28 22:12:12 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 262 ms / 2,000 ms |
| コード長 | 755 bytes |
| コンパイル時間 | 5,806 ms |
| コンパイル使用メモリ | 314,892 KB |
| 実行使用メモリ | 14,336 KB |
| 最終ジャッジ日時 | 2024-06-28 22:12:21 |
| 合計ジャッジ時間 | 8,806 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 19 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using mint = atcoder::static_modint<998244353>;
//using mint = atcoder::static_modint<1000000007>;
using namespace std;
using namespace atcoder;
using ld = long double;
using ll = long long;
#define mp(a,b) make_pair(a,b)
#define rep(i,s,n) for(int i=s; i<n; i++)
const int inf=2e9;
int main(){
int n;
cin >> n;
vector<pair<int,int>> r(n);
rep(i,0,n)cin >> r[i].first >> r[i].second;
sort(r.begin(),r.end());
multiset<int> S;
rep(i,0,n){
int a=r[i].first,b=r[i].second;
auto itr=S.upper_bound(a);
if(itr!=S.begin()){
itr--;
S.erase(itr);
S.insert(b);
}
else S.insert(b);
}
cout << S.size()-1;
}