結果
問題 |
No.686 Uncertain LIS
|
ユーザー |
|
提出日時 | 2023-12-24 20:52:10 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 788 bytes |
コンパイル時間 | 1,664 ms |
コンパイル使用メモリ | 166,776 KB |
実行使用メモリ | 11,424 KB |
最終ジャッジ日時 | 2024-09-27 13:48:21 |
合計ジャッジ時間 | 20,192 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 22 TLE * 5 -- * 9 |
ソースコード
#include <bits/stdc++.h> using namespace std; char buf[(1<<21)+5],*p1,*p2; #define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++) inline int read() { int x = 0, f = 0; char ch = getchar(); while (!isdigit(ch)) f |= (ch == '-'), ch = getchar(); while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar(); return f ? -x : x; } const int N = 5e5 + 500; int f[N]; int ma = 0; signed main() { // freopen("lis.in", "r", stdin); // freopen("1.out", "w", stdout); int T = read(); while (T--) { int l = read(), r = read(); while (ma < r) ++ma, f[ma] = f[ma - 1]; for (int i = r; i >= l; --i) f[i] = f[i - 1] + 1; for (int i = r + 1; i <= ma; ++i) { if (f[i] >= f[r]) break; f[i] = f[r]; } } cout << f[ma]; return 0; }