結果
問題 |
No.686 Uncertain LIS
|
ユーザー |
|
提出日時 | 2025-07-30 00:30:03 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,018 bytes |
コンパイル時間 | 1,846 ms |
コンパイル使用メモリ | 194,488 KB |
実行使用メモリ | 19,352 KB |
最終ジャッジ日時 | 2025-07-30 00:30:10 |
合計ジャッジ時間 | 7,255 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 7 WA * 13 RE * 16 |
ソースコード
#include<bits/stdc++.h> using namespace std; #define fi first #define sc second #define pii pair<int,int> #define pdd pair<double,double> #define pb push_back #define umap unordered_map #define mset multiset #define pq priority_queue #define ull unsigned long long #define i128 __int128 #define ld long double #define fixs fixed<<setprecision const int maxn=2000+10; int n,a[maxn],b[maxn],f[maxn][maxn]; void chkmax(int &x,int y){ x=max(x,y); } void solve(){ cin>>n; for(int i=1;i<=n;i++) cin>>a[i]>>b[i]; for(int i=1;i<=n;i++){ int minn=1e9; for(int j=0;j<=2000;j++) f[i][j]=f[i-1][j]; for(int j=1;j<=b[i];j++) chkmax(f[i][max(j,a[i])],f[i-1][j-1]+1); } cout<<*max_element(f[n]+1,f[n]+2001)<<endl; } int main(){ ios::sync_with_stdio(false); cin.tie(0),cout.tie(0); int t=1; // cin>>t; while(t--) solve(); return 0; } /* Samples input: output: THINGS TODO: 检查freopen,尤其是后缀名 检查空间 检查调试语句是否全部注释 */