結果

問題 No.930 数列圧縮
ユーザー amaridekinai
提出日時 2019-12-01 19:47:39
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 616 bytes
コンパイル時間 640 ms
コンパイル使用メモリ 74,116 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-21 16:02:15
合計ジャッジ時間 5,381 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 5 WA * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<cmath>

using namespace std;
typedef long long ll;

const int inf = 1e8;

int main(){
  int N; cin >> N;
  vector<int> a(N);
  for(int i = 0 ;i < N; i++){ cin >> a[i];}

  if( a[0] > a[N-1]){ cout << "No" << endl; return 0;}
  
  cout << "Yes" << endl;
  
  vector<int> ans;
  
  for(int i = 0 ; i < N; i++){ 
    if( a[i] < a[0]){ ans.push_back(a[i]);}
  }
  
  for(int i = N-1; i > 0; i--){
    if( a[i] >= a[0]){ ans.push_back(a[i]);}
  }
  
  for(auto ne : ans){  cout << ne << " ";}
  
  cout << endl;
  
  return 0;
}
0