結果
問題 | No.686 Uncertain LIS |
ユーザー |
![]() |
提出日時 | 2018-01-14 17:59:34 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 499 bytes |
コンパイル時間 | 565 ms |
コンパイル使用メモリ | 66,304 KB |
実行使用メモリ | 10,496 KB |
最終ジャッジ日時 | 2024-12-24 02:54:01 |
合計ジャッジ時間 | 32,992 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 26 TLE * 10 |
ソースコード
#include <iostream>#include <algorithm>using namespace std;int n, l, r, dp[100009];int main() {cin.tie(0);ios_base::sync_with_stdio(false);cin >> n;for (int i = 0; i <= 100000; i++) dp[i] = -i;for (int i = 0; i < n; i++) {cin >> l >> r;for (int j = r; j >= l; j--) {dp[j] = max(dp[j], dp[j - 1]);}int val = dp[r] + r;for (int j = r + 1; j <= 100000; j++) {if (dp[j] + j >= val) break;dp[j] = val - j;}}cout << dp[100000] + 100000 << endl;return 0;}