結果
| 問題 | No.365 ジェンガソート | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2020-04-14 01:43:50 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 550 bytes | 
| コンパイル時間 | 838 ms | 
| コンパイル使用メモリ | 74,996 KB | 
| 最終ジャッジ日時 | 2025-01-09 18:21:32 | 
| ジャッジサーバーID (参考情報) | judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 16 WA * 25 | 
ソースコード
#include <iostream>
#include <algorithm>
#include <vector>
void solve() {
    int n;
    std::cin >> n;
    std::vector<int> xs(n + 1, n + 1);
    xs[0] = 0;
    for (int i = 0; i < n; ++i) {
        int x;
        std::cin >> x;
        *std::lower_bound(xs.begin(), xs.end(), x) = x;
    }
    for (int i = n; i >= 0; --i) {
        if (xs[i] <= n) {
            std::cout << n - i << std::endl;
            return;
        }
    }
}
int main() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    solve();
    return 0;
}
            
            
            
        