結果

問題 No.930 数列圧縮
ユーザー risujirohrisujiroh
提出日時 2019-03-30 02:29:47
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 38 ms / 2,000 ms
コード長 438 bytes
コンパイル時間 1,599 ms
コンパイル使用メモリ 169,688 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-07 11:15:17
合計ジャッジ時間 3,679 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (auto&& e : a) cin >> e;

  if (a[0] > a.back()) {
    cout << "No\n";
    return 0;
  }
  cout << "Yes\n";

  for (int i = n - 2; i >= 0; --i) {
    if (a[i] < a[0]) {
      cout << a[i] << ' ';
    }
  }
  for (int i = 1; i < n - 1; ++i) {
    if (a[i] > a[0]) {
      cout << a[i] << ' ';
    }
  }
  cout << a.back() << '\n';
}
0