結果

問題 No.686 Uncertain LIS
コンテスト
ユーザー vjudge1
提出日時 2026-10-10 22:24:00
言語 C++23
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
TLE  
実行時間 -
コード長 2,029 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,233 ms
コンパイル使用メモリ 341,484 KB
実行使用メモリ 9,844 KB
最終ジャッジ日時 2026-10-10 22:24:15
合計ジャッジ時間 9,030 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 9 TLE * 1 -- * 26
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
using PII = pair<int, int>;
using PLI = pair<LL, int>;
using PIL = pair<int, LL>;
using PLL = pair<LL, LL>;

string text_yes, text_no;

void set_yes_no_all_lower() {
    text_yes = "yes";
    text_no = "no";
}
void set_yes_no_all_upper() {
    text_yes = "YES";
    text_no = "NO";
}
void set_yes_no_first_upper_other_lower() {
    text_yes = "Yes";
    text_no = "No";
}

void yes() {
    cout << text_yes << endl;
}
void no() {
    cout << text_no << endl;
}

template <typename T, typename = void>
struct is_iterable : false_type {};

template <typename T>
struct is_iterable<T, void_t<decltype(begin(declval<T&>())), decltype(end(declval<T&>()))>> : true_type {};

template <typename T>
enable_if_t<is_iterable<T>::value && !is_same_v<T, string>, istream&> operator>>(istream& in, T& value) {
    for (auto& i : value) {
        in >> i;
    }
    return in;
}

bool solve(int);
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    set_yes_no_all_lower();
    set_yes_no_all_upper();
    set_yes_no_first_upper_other_lower();

    int T = 1;
    // cin >> T;
    for (int t = 1; t <= T && solve(t); ++t) {
    }
    return 0;
}

#define lson (k << 1)
#define rson (k << 1 | 1)

const int mod = 7 + 1e9;
// const int mod = 998244353;
const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};

#if LEMON
const int N = 3 + 256;
#else
#define endl '\n'
const int N = 3 + 5e5;
#endif

bool solve(int case_id) {
    int n;
    cin >> n;
    map<int, int> dp;
    dp[0] = 0;
    while (n--) {
        int l, r;
        cin >> l >> r;

        auto ndp = dp;
        for (auto [u, v] : ndp) {
            if (r > v) {
                int p = max(v + 1, l);
                if (!dp.count(u + 1)) {
                    dp[u + 1] = 1e9;
                }
                dp[u + 1] = min(dp[u + 1], p);
            }
        }
    }
    cout << dp.size() - 1;

    return true;
}
0