結果

問題 No.711 競技レーティング単調増加
ユーザー rapurasurapurasu
提出日時 2018-07-13 09:33:23
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 99 ms / 2,000 ms
コード長 864 bytes
コンパイル時間 1,591 ms
コンパイル使用メモリ 163,992 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-16 08:18:44
合計ジャッジ時間 5,502 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
6,812 KB
testcase_01 AC 3 ms
6,944 KB
testcase_02 AC 4 ms
6,944 KB
testcase_03 AC 4 ms
6,940 KB
testcase_04 AC 3 ms
6,944 KB
testcase_05 AC 3 ms
6,940 KB
testcase_06 AC 3 ms
6,944 KB
testcase_07 AC 3 ms
6,944 KB
testcase_08 AC 3 ms
6,940 KB
testcase_09 AC 3 ms
6,944 KB
testcase_10 AC 3 ms
6,944 KB
testcase_11 AC 4 ms
6,944 KB
testcase_12 AC 3 ms
6,940 KB
testcase_13 AC 3 ms
6,944 KB
testcase_14 AC 4 ms
6,940 KB
testcase_15 AC 3 ms
6,940 KB
testcase_16 AC 3 ms
6,940 KB
testcase_17 AC 3 ms
6,944 KB
testcase_18 AC 61 ms
6,944 KB
testcase_19 AC 58 ms
6,940 KB
testcase_20 AC 62 ms
6,944 KB
testcase_21 AC 65 ms
6,940 KB
testcase_22 AC 61 ms
6,940 KB
testcase_23 AC 69 ms
6,940 KB
testcase_24 AC 67 ms
6,940 KB
testcase_25 AC 56 ms
6,940 KB
testcase_26 AC 60 ms
6,940 KB
testcase_27 AC 56 ms
6,944 KB
testcase_28 AC 45 ms
6,944 KB
testcase_29 AC 53 ms
6,944 KB
testcase_30 AC 71 ms
6,940 KB
testcase_31 AC 86 ms
6,940 KB
testcase_32 AC 91 ms
6,940 KB
testcase_33 AC 83 ms
6,940 KB
testcase_34 AC 76 ms
6,944 KB
testcase_35 AC 85 ms
6,944 KB
testcase_36 AC 33 ms
6,944 KB
testcase_37 AC 99 ms
6,944 KB
testcase_38 AC 70 ms
6,940 KB
testcase_39 AC 34 ms
6,944 KB
testcase_40 AC 44 ms
6,940 KB
testcase_41 AC 4 ms
6,944 KB
testcase_42 AC 39 ms
6,940 KB
testcase_43 AC 53 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
LL A[200001];
LL B[200011];
int N;

int binary_serach(LL x){
	int lb=-1;
	int ub=200010;
	while(ub-lb>1){
		int mid=(ub+lb)/2;
		if(B[mid]>x){
			ub=mid;
		}else{
			lb=mid;
		}
	}
	return ub;
}

int main(){
	cin>>N;
	REP(i,N){
		cin>>A[i];
		A[i]-=i;
	}
	REP(i,200011){
		B[i]=1e12;
	}
	REP(i,N){
		if(A[i]<=0){
			continue;
		}
		int b=binary_serach(A[i]);
		B[b]=A[i];
		/*cout<<"test"<<endl;
		REP(j,10){
			cout<<B[j]<<endl;
		}*/
		//cout<<b<<" "<<A[i]<<endl;
	}
	/*
	cout<<"end"<<endl;
	REP(i,20){
		cout<<B[i]<<endl;
	}*/
	int ans=0;
	REP(i,200011){
		if(B[i]!=1e12)ans++;
	}
	cout<<N-ans<<endl;
	return(0);
}
0