結果
問題 | No.686 Uncertain LIS |
ユーザー |
![]() |
提出日時 | 2018-01-14 18:25:10 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 513 bytes |
コンパイル時間 | 610 ms |
コンパイル使用メモリ | 66,304 KB |
実行使用メモリ | 8,704 KB |
最終ジャッジ日時 | 2024-12-24 02:55:46 |
合計ジャッジ時間 | 13,165 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 34 TLE * 2 |
ソースコード
#include <iostream>#include <algorithm>using namespace std;const int inf = 1012345678;int n, l, r, d[100009];int main() {cin.tie(0);ios_base::sync_with_stdio(false);for (int i = 0; i <= 100000; i++) d[i] = inf;cin >> n;for (int i = 0; i < n; i++) {cin >> l >> r;int pl = lower_bound(d, d + 100001, l) - d;int pr = lower_bound(d, d + 100001, r) - d;for (int j = pr; j >= pl + 1; j--) d[j] = d[j - 1] + 1;d[pl] = l;}cout << lower_bound(d, d + 100001, inf) - d << endl;return 0;}