結果

問題 No.711 競技レーティング単調増加
ユーザー kakira9618kakira9618
提出日時 2018-06-30 00:29:58
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,492 bytes
コンパイル時間 1,043 ms
コンパイル使用メモリ 85,748 KB
実行使用メモリ 4,872 KB
最終ジャッジ日時 2023-09-13 15:57:23
合計ジャッジ時間 3,870 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
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 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 28 ms
4,376 KB
testcase_37 WA -
testcase_38 WA -
testcase_39 AC 28 ms
4,376 KB
testcase_40 WA -
testcase_41 AC 2 ms
4,376 KB
testcase_42 AC 34 ms
4,376 KB
testcase_43 AC 49 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
  
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
  
using namespace std;
  
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
  
const int INF=1e9;
const double EPS=1e-9;
  
const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

int LIS(vector<int> &A) {
  /*
  int N = A.size();
  vector<int> dp(A.size() + 1, INF);
  for (int i = 0; i < N; i++) {
    *upper_bound(dp.begin(), dp.end(), A[i]) = A[i];
  }
  return lower_bound(dp.begin(), dp.end(), INF) - dp.begin();
  */
  int m = A.size();
  const int inf = 1e9;
  vector<int> dp(m + 1, inf);
  for (int i = 0; i < m; i++) *upper_bound(dp.begin(), dp.end(), A[i]) = A[i];
  return lower_bound(dp.begin(), dp.end(), inf) - dp.begin();
}

int main() {
  int N;
  cin >> N;
  vector<int> A;
  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    if (a - i > 0) {
      A.push_back(a);
    }
  }
  cout << N - LIS(A) << endl;

  return 0;
}
0