結果
問題 |
No.711 競技レーティング単調増加
|
ユーザー |
![]() |
提出日時 | 2017-10-02 11:57:04 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 532 bytes |
コンパイル時間 | 1,965 ms |
コンパイル使用メモリ | 170,016 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-15 22:40:13 |
合計ジャッジ時間 | 4,248 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 39 WA * 2 |
ソースコード
#include <bits/stdc++.h> using namespace std; int solve() { int n; cin >> n; vector<int> A; for (int i = 0; i < n; i++) { int a; cin >> a; if (a - i >= 0) { A.emplace_back(a - i); } } int m = A.size(); const int inf = 1e9; vector<int> dp(m, inf); for (int i = 0; i < m; i++) *upper_bound(dp.begin(), dp.end(), A[i]) = A[i]; int lis = lower_bound(dp.begin(), dp.end(), inf) - dp.begin(); return n - lis; } int main() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << solve() << endl; return 0; }