結果

問題 No.711 競技レーティング単調増加
ユーザー とばり
提出日時 2018-08-04 20:40:30
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 600 bytes
コンパイル時間 788 ms
コンパイル使用メモリ 72,432 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-19 17:56:26
合計ジャッジ時間 3,652 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24 WA * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

using int64 = long long;

const int MAX_N = 200000;
const int64 INF = (1LL << 50);

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int N;
    cin >> N;

    vector<int64> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
    vector<int64> dp(N, INF);
    for (int i = 0; i < N; i++) {
        *upper_bound(dp.begin(), dp.end(), A[i] - i) = A[i] - i;
    }

    int maxLength = lower_bound(dp.begin(), dp.end(), INF) - dp.begin();

    cout << N - maxLength << endl;

    return 0;
}
0