結果
| 問題 | No.686 Uncertain LIS |
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2025-02-28 21:12:51 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 651 bytes |
| 記録 | |
| コンパイル時間 | 3,305 ms |
| コンパイル使用メモリ | 274,240 KB |
| 実行使用メモリ | 13,636 KB |
| 最終ジャッジ日時 | 2025-02-28 21:13:11 |
| 合計ジャッジ時間 | 18,469 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 26 TLE * 1 -- * 9 |
ソースコード
#include<bits/stdc++.h>
#define maxn 100005
using namespace std;
int n,L[maxn],R[maxn],ans=1,dp[maxn];
signed main(){
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cin>>n;for(int i=1;i<=n;++i)cin>>L[i]>>R[i];
for(int i=0;i<=n;++i)dp[i]=100001;dp[0]=0;
for(int i=1;i<=n;++i){
int l=0,r=i-1,mid,st=-1;
while(l<=r){
mid=(l+r)>>1;
if(dp[mid]<R[i])st=mid,l=mid+1;
else r=mid-1;
}
for(int j=st;j>=0;--j)
dp[j+1]=min(dp[j+1],max(dp[j]+1,L[i]));
}
for(int i=1;i<=n;++i){
if(dp[i]!=100001)ans=i;
else break;
}
cout<<ans;
return 0;
}
vjudge1