結果
| 問題 | No.930 数列圧縮 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-11-26 21:23:13 |
| 言語 | C++14 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 13 ms / 2,000 ms |
| + 906µs | |
| コード長 | 700 bytes |
| 記録 | |
| コンパイル時間 | 392 ms |
| コンパイル使用メモリ | 79,116 KB |
| 実行使用メモリ | 9,868 KB |
| 最終ジャッジ日時 | 2026-11-26 21:23:18 |
| 合計ジャッジ時間 | 3,732 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 |
ソースコード
#include <iostream>
#include <cstdio>
using namespace std;
const int N = 100010;
int n, a[N], cnt, ans[N];
int main() {
// freopen("compress.in", "r", stdin);
// freopen("compress.out", "w", stdout);
scanf("%d", &n);
for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
if (a[1] > a[n]) {
puts("No");
return 0;
}
int l = 2;
for (int i = 2; i <= n; ++i) {
if (a[i] > a[1]) {
for (int j = i - 1; j >= l; --j) ans[++cnt] = a[j];
ans[++cnt] = a[i];
l = i + 1;
}
}
puts("Yes");
for (int i = 1; i <= cnt; ++i) {
printf("%d%c", ans[i], " \n"[i == cnt]);
}
return 0;
}