結果
問題 | No.711 競技レーティング単調増加 |
ユーザー |
![]() |
提出日時 | 2018-10-02 22:23:48 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 84 ms / 2,000 ms |
コード長 | 458 bytes |
コンパイル時間 | 418 ms |
コンパイル使用メモリ | 57,636 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-12 10:06:29 |
合計ジャッジ時間 | 3,271 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 41 |
ソースコード
#include <iostream>#include <algorithm>using namespace std;const int INF = 1<<30;int n;int a[200000];int dp[200000];int main(int argc, char *argv[]){cin >> n;for (int i = 0; i < n; i++) {cin >> a[i];a[i] -= i;}fill(dp, dp + n, INF);for (int i = 0; i < n; i++) {if (a[i] > 0)*upper_bound(dp, dp + n, a[i]) = a[i];}int ret = lower_bound(dp, dp + n, INF) - dp;cout << n - ret << endl;return 0;}