結果
問題 |
No.711 競技レーティング単調増加
|
ユーザー |
![]() |
提出日時 | 2018-08-04 20:45:14 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 35 ms / 2,000 ms |
コード長 | 637 bytes |
コンパイル時間 | 647 ms |
コンパイル使用メモリ | 74,040 KB |
実行使用メモリ | 6,400 KB |
最終ジャッジ日時 | 2024-09-19 17:56:38 |
合計ジャッジ時間 | 2,824 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 41 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> using namespace std; using int64 = long long; const int MAX_N = 200000; const int64 INF = (1LL << 50); int main() { cin.tie(0); ios::sync_with_stdio(false); int N; cin >> N; vector<int64> A(N); for (int i = 0; i < N; i++) { cin >> A[i]; } vector<int64> dp(N, INF); for (int i = 0; i < N; i++) { if (A[i] - i <= 0) continue; *upper_bound(dp.begin(), dp.end(), A[i] - i) = A[i] - i; } int maxLength = lower_bound(dp.begin(), dp.end(), INF) - dp.begin(); cout << N - maxLength << endl; return 0; }