結果
| 問題 | No.711 競技レーティング単調増加 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2018-07-13 21:49:37 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 90 ms / 2,000 ms | 
| コード長 | 725 bytes | 
| コンパイル時間 | 1,428 ms | 
| コンパイル使用メモリ | 167,340 KB | 
| 実行使用メモリ | 6,784 KB | 
| 最終ジャッジ日時 | 2024-10-09 05:08:24 | 
| 合計ジャッジ時間 | 4,397 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 41 | 
ソースコード
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<double, int> P;
typedef pair<int, P> E;
#define MOD (1000000007ll)
#define l_ength size
#define EPS (1e-10)
void add_mod(ll &a, ll b){
	a += b;
	a %= MOD;
}
void mul_mod(ll &a, ll b){
	a *= b;
	a %= MOD;
}
int main(void){
	int n,i;
	ll a[225816],b[225816];
	fill(b,b+225816,INFLL);
	cin >> n;
	for(i=0; i<n; ++i){
		cin >> a[i];
		a[i] -= i;
	}
	for(i=0; i<n; ++i){
		if(a[i]<1){
			continue;
		}
		if(*lower_bound(b,b+n,a[i]) == a[i]){
			*lower_bound(b,b+n,a[i]+1) = a[i];
		}else{
			*lower_bound(b,b+n,a[i]) = a[i];
		}
	}
	cout << ((n-(int)(lower_bound(b,b+n,INFLL)-b))) << endl;
	return 0;
}
            
            
            
        