結果
問題 | No.930 数列圧縮 |
ユーザー |
![]() |
提出日時 | 2019-11-23 00:23:10 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 24 ms / 2,000 ms |
コード長 | 826 bytes |
コンパイル時間 | 1,752 ms |
コンパイル使用メモリ | 169,168 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-11 06:37:13 |
合計ジャッジ時間 | 3,742 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
ソースコード
#define _USE_MATH_DEFINES#include <bits/stdc++.h>using namespace std;//template#define rep(i,a,b) for(int i=(a);i<(b);i++)#define rrep(i,a,b) for(int i=(a);i>(b);i--)#define ALL(v) (v).begin(),(v).end()typedef long long int ll; const int inf = 0x3fffffff; const ll INF = 0x3fffffffffffffff;template<class T> inline bool chmax(T& a,T b){ if(a<b){a=b;return 1;}return 0; }template<class T> inline bool chmin(T& a,T b){ if(a>b){a=b;return 1;}return 0; }//template endint main(){int n; scanf("%d",&n);vector<int> a(n),ans;rep(i,0,n)scanf("%d",&a[i]);if(a[0]>a[n-1]){printf("No\n"); return 0;}printf("Yes\n");rep(i,1,n-1)if(a[0]<a[i])ans.push_back(a[i]);rrep(i,n-2,-1)if(a[0]>a[i])ans.push_back(a[i]);ans.push_back(a[0]);rep(i,0,n-1)printf("%d\n",ans[i]);return 0;}