結果

問題 No.711 競技レーティング単調増加
ユーザー しらっ亭
提出日時 2017-05-23 00:49:44
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 531 bytes
コンパイル時間 1,559 ms
コンパイル使用メモリ 168,312 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-19 10:32:46
合計ジャッジ時間 3,561 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13 WA * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

// LIS を使った WA 解
#include <bits/stdc++.h>
using namespace std;

int solve() {
  int n;
  cin >> n;
  vector<int> A(n);
  for (int i = 0; i < n; i++) cin >> A[i];

  // LIS の長さを求めています
  const int inf = 1e9;
  vector<int> dp(n, inf);
  for (int i = 0; i < n; i++) *lower_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;
}
0