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