結果
問題 |
No.686 Uncertain LIS
|
ユーザー |
![]() |
提出日時 | 2019-06-07 12:00:08 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,117 bytes |
コンパイル時間 | 1,422 ms |
コンパイル使用メモリ | 170,540 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-04 20:05:18 |
合計ジャッジ時間 | 3,841 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 WA * 26 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define llong long long int #define ldouble long double #define rep(i, n) for (int i = 0; i < n; ++i) #define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr) #define stl_repr(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr) #define all(x) x.begin(), x.end() #define allr(x) x.rbegin(), x.rend() const static int MOD = 1000000000 + 7; const static int inf = INT_MAX / 2; const static llong INF = 1LL << 31; const static int dx[] = {1, 0, -1, 0}; const static int dy[] = {0, 1, 0, -1}; int main (int argc, char *argv[]) { cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; vector<int> L(n), R(n), dp; rep(i, n) cin >> L[i] >> R[i]; dp.push_back(L[0]); for (int i = 1; i < n; ++i) { if (L[i] > dp.back()) { dp.push_back(L[i]); } else { if (R[i] <= dp.back()) { *lower_bound(all(dp), L[i]) = L[i]; } else { dp.push_back(dp.back() + 1); } } } cout << dp.size() << endl; return 0; }