結果
| 問題 |
No.930 数列圧縮
|
| コンテスト | |
| ユーザー |
QCFium
|
| 提出日時 | 2019-11-22 22:20:11 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 671 bytes |
| コンパイル時間 | 1,604 ms |
| コンパイル使用メモリ | 169,256 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-11 04:01:05 |
| 合計ジャッジ時間 | 5,811 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 6 WA * 18 |
ソースコード
#include <bits/stdc++.h>
int ri() {
int n;
scanf("%d", &n);
return n;
}
int main() {
int n = ri();
int a[n];
for (int i = 0; i < n; i++) a[i] = ri();
if (a[0] > a[n - 1]) std::cout << "No" << std::endl;
else {
std::cout << "Yes" << std::endl;
std::vector<int> newed;
for (int i = 1; i + 1 < n; i++) {
if (i + 2 < n && a[i] < a[i + 1]) std::cout << a[i] << " ";
else newed.push_back(a[i]);
}
int i = 0;
for (; i < (int) newed.size() && newed[i] > a[0]; i++) std::cout << newed[i] << " ";
for (int j = (int) newed.size() - 1; j >= i; j--) std::cout << newed[i] << " ";
std::cout << a[n - 1] << " ";
std::cout << std::endl;
}
return 0;
}
QCFium