結果

問題 No.711 競技レーティング単調増加
ユーザー rpy3cpprpy3cpp
提出日時 2018-08-12 01:53:30
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 651 bytes
コンパイル時間 1,585 ms
コンパイル使用メモリ 170,224 KB
実行使用メモリ 6,508 KB
最終ジャッジ日時 2023-10-24 14:18:27
合計ジャッジ時間 6,089 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 WA -
testcase_04 AC 2 ms
4,348 KB
testcase_05 WA -
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 1 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 2 ms
4,348 KB
testcase_16 AC 2 ms
4,348 KB
testcase_17 AC 2 ms
4,348 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 67 ms
5,964 KB
testcase_31 AC 82 ms
5,964 KB
testcase_32 AC 86 ms
6,228 KB
testcase_33 AC 78 ms
6,228 KB
testcase_34 AC 73 ms
5,964 KB
testcase_35 AC 81 ms
6,492 KB
testcase_36 AC 35 ms
6,492 KB
testcase_37 AC 86 ms
6,228 KB
testcase_38 AC 60 ms
5,964 KB
testcase_39 AC 31 ms
4,908 KB
testcase_40 AC 44 ms
5,172 KB
testcase_41 AC 2 ms
4,348 KB
testcase_42 AC 37 ms
4,908 KB
testcase_43 AC 53 ms
5,436 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

// Longest Increasing Subsequence の長さを返す。広義単調増加。
template <typename T>
auto LIS_weak_size(const vector<T> &vs){
    const auto n = vs.size();
    constexpr T inf = numeric_limits<T>::max();
    vector<T> A(n, inf);
    for (auto v : vs) A[distance(A.begin(), upper_bound(A.begin(), A.end(), v))] = v;
    return distance(A.begin(), lower_bound(A.begin(), A.end(), inf));
}

int main() {
    int N;
    cin >> N;
    vector<long long> As(N);
    for (auto &a : As) cin >> a;
    for (int i = 0; i < N; ++i) As[i] -= i;
    cout << N - LIS_weak_size(As) << endl;
    return 0;
}
0