int a[1d5],b[1d5],c[1d5]; { int@n; rd(a(n-1)); rep(i,n-1)b[i]=i; sortA(n-1,a,b); rep(i,n-1){ if(a[i]>i+1){ wt("NO"); exit(0); } c[b[i]]=i+1-a[i]; } wt("YES"); wtLn(c(n-1)); }