結果

問題 No.711 競技レーティング単調増加
ユーザー beetbeet
提出日時 2018-11-09 12:49:53
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 81 ms / 2,000 ms
コード長 614 bytes
コンパイル時間 2,075 ms
コンパイル使用メモリ 201,196 KB
実行使用メモリ 6,312 KB
最終ジャッジ日時 2023-08-13 10:51:34
合計ジャッジ時間 5,252 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 54 ms
5,616 KB
testcase_19 AC 53 ms
5,752 KB
testcase_20 AC 56 ms
5,892 KB
testcase_21 AC 59 ms
5,884 KB
testcase_22 AC 55 ms
5,664 KB
testcase_23 AC 61 ms
6,228 KB
testcase_24 AC 61 ms
6,052 KB
testcase_25 AC 51 ms
5,804 KB
testcase_26 AC 55 ms
5,788 KB
testcase_27 AC 50 ms
5,804 KB
testcase_28 AC 42 ms
5,736 KB
testcase_29 AC 50 ms
6,264 KB
testcase_30 AC 63 ms
5,752 KB
testcase_31 AC 77 ms
5,668 KB
testcase_32 AC 81 ms
5,960 KB
testcase_33 AC 74 ms
5,956 KB
testcase_34 AC 69 ms
5,696 KB
testcase_35 AC 77 ms
6,180 KB
testcase_36 AC 30 ms
6,312 KB
testcase_37 AC 81 ms
6,012 KB
testcase_38 AC 56 ms
5,644 KB
testcase_39 AC 29 ms
4,732 KB
testcase_40 AC 40 ms
4,852 KB
testcase_41 AC 1 ms
4,384 KB
testcase_42 AC 35 ms
4,676 KB
testcase_43 AC 50 ms
5,164 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
signed main(){
  Int n;
  cin>>n;
  vector<Int> a(n);
  for(Int i=0;i<n;i++) cin>>a[i];

  const Int INF = 1e15;
  vector<Int> lis(n+1,INF);
  for(Int i=0;i<n;i++){
    a[i]-=i+1;
    if(a[i]<0) continue;
    Int k=upper_bound(lis.begin(),lis.end(),a[i])-lis.begin();
    lis[k]=a[i];
  }
  
  Int ans=0;
  while(lis[ans]<INF) ans++;
  cout<<n-ans<<endl;
  return 0;
}
0