結果
| 問題 | No.686 Uncertain LIS | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2025-03-03 20:55:25 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                TLE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 563 bytes | 
| コンパイル時間 | 1,764 ms | 
| コンパイル使用メモリ | 162,268 KB | 
| 実行使用メモリ | 12,316 KB | 
| 最終ジャッジ日時 | 2025-03-03 20:55:31 | 
| 合計ジャッジ時間 | 5,614 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 9 TLE * 1 -- * 26 | 
ソースコード
#include<bits/stdc++.h>
#define maxn 100005
using namespace std;
int n,L[maxn],R[maxn],ans,dp[maxn],maxx;
bitset<maxn>f;
signed main(){
    // freopen("lis.in","r",stdin);
	// freopen("lis.out","w",stdout);
    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];f[0]=1;
    for(int i=1;i<=n;++i){
        for(int j=R[i];j<=maxx;++j)if(f[j]){f[j]=0;break;}
        for(int j=R[i]-1;j>=L[i];--j)f[j+1]=f[j];f[L[i]]=1;
        maxx=max(maxx,R[i]);
    }
    for(int i=1;i<=maxx;++i)if(f[i])ans++;
    cout<<ans;
	return 0;
}
            
            
            
        