#include #define rep(a,n) for (ll a = 0; a < (n); ++a) using namespace std; //using namespace atcoder; using ll = long long; typedef pair P; typedef pair PP; typedef vector > Graph; template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a >= b) { a = b; return 1; } return 0; } const ll INF = 1e18+7; #define debug(v) cout<<#v<<": ",prt(v); template inline void prt(pair p){cout<<"("< inline void prt(tuple p){cout<<"("<(p)<<", "<(p)<<", "<(p)<<")\n";} inline void prt(bool p){if(p)cout<<"True"<<'\n';else cout<<"False"<<'\n';} template inline void prt(vector v){cout<<'{';for(ll i=0;i inline void prt(vector >& vv){ for(const auto& v : vv){ prt(v); } } template inline void prt(deque v){cout<<'{';for(ll i=0;i inline void prt(map v){cout<<'{';ll c=0;for(auto &p: v){cout< inline void prt(unordered_map v){cout<<'{';ll c=0;for(auto &p: v){cout< inline void prt(set v){cout<<'{';for(auto i=v.begin();i!=v.end();i++){cout<<*i;if(i!=--v.end())cout<<", ";}cout<<'}'<<'\n';} template inline void prt(multiset v){cout<<'{';for(auto i=v.begin();i!=v.end();i++){cout<<*i;if(i!=--v.end())cout<<", ";}cout<<'}'<<'\n';} /* 方針 sortした状態で考える */ int main(){ ll n; cin >> n; vectora(n-1); rep(i,n-1)cin>>a[i]; vector

v(n-1); rep(i,n-1)v[i]={a[i],i}; sort(v.begin(),v.end()); vectorans(n-1); vectordone(n); done[0]=true; rep(i,n-1){ if(i+1-v[i].first<0){ cout << "NO" << endl; return 0; } done[i+v[i].first]=true; ans[v[i].second]=i+2-v[i].first; //cout << ans[v[i].second] << endl; } cout << "YES" << endl; rep(i,n-1){ cout << ans[i] << endl; } //debug(ans); return 0; }