結果
問題 | No.711 競技レーティング単調増加 |
ユーザー |
![]() |
提出日時 | 2018-11-09 12:49:53 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 102 ms / 2,000 ms |
コード長 | 614 bytes |
コンパイル時間 | 1,979 ms |
コンパイル使用メモリ | 195,848 KB |
最終ジャッジ日時 | 2025-01-06 15:54:25 |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 41 |
ソースコード
#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; }