結果
問題 |
No.2796 Small Matryoshka
|
ユーザー |
![]() |
提出日時 | 2024-06-29 12:43:59 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 730 bytes |
コンパイル時間 | 2,233 ms |
コンパイル使用メモリ | 201,612 KB |
最終ジャッジ日時 | 2025-02-22 01:34:33 |
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 8 WA * 11 |
ソースコード
#include <bits/stdc++.h> using namespace std; void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); } int main() { fast_io(); int n; cin >> n; vector<pair<int, int>> rR(n); for (int i = 0; i < n; i++) { cin >> rR[i].first >> rR[i].second; } sort(rR.begin(), rR.end()); vector<int> dp(n + 1, 2e9); dp[0] = 0; for (auto [r, R] : rR) { auto lb = lower_bound(dp.begin(), dp.end(), r + 1); if (*lb > R) { *lb = R; } } // for (int i = 0; i <= n; i++) { // cout << dp[i] << " "; // } // cout << endl; int ans = lower_bound(dp.begin(), dp.end(), 2e9) - dp.begin(); cout << n - ans + 1 << endl; }