結果
| 問題 |
No.711 競技レーティング単調増加
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-11-18 14:26:07 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 696 bytes |
| コンパイル時間 | 594 ms |
| コンパイル使用メモリ | 63,444 KB |
| 実行使用メモリ | 12,580 KB |
| 最終ジャッジ日時 | 2025-11-18 14:26:13 |
| 合計ジャッジ時間 | 5,938 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 15 TLE * 1 -- * 25 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:11:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
11 | scanf("%d", &n);
| ~~~~~^~~~~~~~~~
main.cpp:12:39: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
12 | for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
| ~~~~~^~~~~~~~~~~~~
ソースコード
#include <iostream>
#include <cstring>
using namespace std;
const int N = 200010, INF = 0x3f3f3f3f;
int n, a[N], dp[N], ans;
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
memset(dp, 0x3f, sizeof(dp));
dp[0] = 0;
for (int i = 1; i <= n; ++i) {
for (int j = i; j >= 0; --j) {
if (j == i) {
dp[j] = i;
ans = i;
} else {
dp[j] = a[i] > dp[j] ? a[i] : INF;
if (j >= 1) dp[j] = min(dp[j], dp[j - 1] + 1);
}
if (dp[j] != INF) {
ans = j;
}
}
}
printf("%d\n", ans);
return 0;
}