/* -*- coding: utf-8 -*- * * 930.cc: No.930 数列圧縮 - yukicoder */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; /* constant */ const int MAX_N = 100000; const int INF = 1 << 30; /* typedef */ /* global variables */ int as[MAX_N], bs[MAX_N]; /* subroutines */ /* main */ int main() { int n; scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%d", as + i); if (as[0] > as[n - 1]) puts("No"); else { int m = 0; for (int i = 1; i < n - 1; i++) if (as[0] < as[i]) bs[m++] = as[i], as[i] = INF; for (int i = n - 2; i > 0; i--) if (as[i] < as[n - 1]) bs[m++] = as[i], as[i] = -1; bs[m++] = as[0]; puts("Yes"); for (int i = 0; i < m; i++) { if (i) putchar(' '); printf("%d", bs[i]); } putchar('\n'); } return 0; }