結果
| 問題 |
No.711 競技レーティング単調増加
|
| コンテスト | |
| ユーザー |
ats5515
|
| 提出日時 | 2018-06-29 23:10:27 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 818 bytes |
| コンパイル時間 | 654 ms |
| コンパイル使用メモリ | 85,228 KB |
| 実行使用メモリ | 9,428 KB |
| 最終ジャッジ日時 | 2024-07-01 00:11:56 |
| 合計ジャッジ時間 | 2,760 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 24 WA * 17 |
ソースコード
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
int INF = (int)1 << 62;
int getLIS(vector<pair<int,int> > &a)
{
int N = a.size();
pair<int, int> inf;
inf = make_pair(INF, INF);
vector<pair<int,int> > dp(N, inf);
for (int i = 0; i<N; ++i) {
*lower_bound(dp.begin(), dp.begin() + N, a[i]) = a[i];
}
return lower_bound(dp.begin(), dp.begin() + N, inf) - dp.begin();
}
signed main() {
cin.tie(0);
ios::sync_with_stdio(false);
int N;
cin >> N;
vector<pair<int,int> > A(N);
int res = 0;
for (int i = 0; i < N; i++) {
cin >> A[i].first;
A[i].first -= i;
A[i].second = i;
}
cout << N - getLIS(A) << endl;
}
ats5515