結果

問題 No.686 Uncertain LIS
ユーザー chocoruskchocorusk
提出日時 2018-12-18 12:30:31
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 951 bytes
コンパイル時間 804 ms
コンパイル使用メモリ 96,428 KB
実行使用メモリ 9,128 KB
最終ジャッジ日時 2023-10-25 23:38:16
合計ジャッジ時間 4,935 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
9,128 KB
testcase_01 AC 4 ms
5,024 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 36 ms
5,016 KB
testcase_04 AC 15 ms
5,020 KB
testcase_05 AC 50 ms
5,020 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 TLE -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
const int INF=1e9;
int bit[100002]; int n0;
int mx[100002];
int max(int i){
	int s=0;
	while(i>0){
		s=max(s, bit[i]);
		i-=(i&(-i));
	}
	return s;
}
void update(int i, int x){
	if(mx[i]>=x) return;
	mx[i]=x;
	while(i<=n0){
		bit[i]=max(bit[i], x);
		i+=(i&(-i));
	}
}
int main()
{
	n0=1e5;
	int n; cin>>n;
	int l[100001], r[100001];
	cin>>l[0]>>r[0];
	for(int j=l[0]; j<=r[0]; j++){
		update(j, 1);
	}
	for(int i=1; i<n; i++){
		cin>>l[i]>>r[i];
		for(int j=r[i]; j>=l[i]; j--){
			int m=max(j-1);
			update(j, m+1);
		}
	}
	cout<<max(n0)<<endl;
	return 0;
}
0