結果
| 問題 |
No.711 競技レーティング単調増加
|
| コンテスト | |
| ユーザー |
しらっ亭
|
| 提出日時 | 2017-05-23 01:10:06 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 727 bytes |
| コンパイル時間 | 1,621 ms |
| コンパイル使用メモリ | 171,164 KB |
| 実行使用メモリ | 813,696 KB |
| 最終ジャッジ日時 | 2024-09-19 10:35:08 |
| 合計ジャッジ時間 | 3,724 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 15 MLE * 1 -- * 25 |
ソースコード
// O(n^2) のTLE解
#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];
const int inf = 1e9 + 1e6;
vector<vector<int>> dp(n+1, vector<int>(n+1, inf));
dp[0][0] = 0;
for (int i = 0; i < n; i++) {
for (int j = 0; j < i + 1; j++) {
if (dp[i][j] >= inf) continue;
if (dp[i][j] < A[i]) {
dp[i+1][j] = min(dp[i+1][j], A[i]);
}
dp[i+1][j+1] = min(dp[i+1][j+1], dp[i][j] + 1);
}
}
for (int j = 0; j < n; j++) {
if (dp[n][j] < inf) {
return j;
}
}
assert(false);
}
int main() {
cin.tie(nullptr); ios::sync_with_stdio(false);
cout << solve() << endl;
return 0;
}
しらっ亭