結果

問題 No.711 競技レーティング単調増加
ユーザー koba-e964koba-e964
提出日時 2017-10-01 21:24:41
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 604 bytes
コンパイル時間 483 ms
コンパイル使用メモリ 60,668 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-27 17:35:59
合計ジャッジ時間 3,192 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <vector>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)

using namespace std;
typedef long long int ll;
typedef vector<int> VI;


int main(void) {
  int n;
  cin >> n;
  vector<ll> a(n);
  REP(i, 0, n) {
    cin >> a[i];
    a[i] -= i + 1;
  }
  int maxl = 0;
  VI m(n + 1, -1);
  REP(i, 0, n) {
    int lo = 0;
    int hi = maxl + 1;
    while (hi - lo > 1) {
      int mid = (hi + lo) / 2;
      if (a[m[mid]] <= a[i]) {
	lo = mid;
      } else {
	hi = mid;
      }
    }
    int l = lo + 1;
    maxl = max(maxl, l);
    m[l] = i;
  }
  cout << n - maxl << endl;
}
0