結果
問題 |
No.930 数列圧縮
|
ユーザー |
![]() |
提出日時 | 2019-11-26 22:42:59 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 19 ms / 2,000 ms |
コード長 | 709 bytes |
コンパイル時間 | 568 ms |
コンパイル使用メモリ | 70,192 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-07 00:59:29 |
合計ジャッジ時間 | 2,557 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
ソースコード
#include <iostream> #include <vector> using namespace std; constexpr int INF = 1 << 30; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; vector<int> a(n+1); for(int i=0;i<n;++i){ cin >> a[i]; } if(a[0] > a[n-1]) { cout << "No" << endl; return 0; } cout << "Yes" << endl; int i = 0; while(i < n-1) { int j = i+1; while(j < n-1 && a[i] < a[j] && a[0] < a[j]) { cout << a[j] << " "; a[j] = INF; ++j; } i = j; } i = n-2; while(i > 0) { if(a[i] < a[n-1]) cout << a[i] << " "; --i; } cout << a[n-1] << endl; }