Language: C++

#include <bits/stdc++.h>
typedef long long ll;
const int INF=1e9,MOD=1e9+7,ohara=1e6;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(ll (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(ll i=(a);i<(b);i++)
#define rrrep(i,a,b) for(ll i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl

ll n,cnt,ans[ohara],b,c,d,tmp[ohara],tmpp,m,h,w,x[ohara],y,sum,pos;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};
map<pair<ll,ll>,ll> mp;
map<ll,ll> cou;
map<ll,ll> couu;
pair<ll,ll> p[ohara];

//-------------------------↓↓↓↓↓↓------------------------

int main(void){
       cin.tie(0);
    ios::sync_with_stdio(false);
      
    cin>>n;
    rep(i,n)cin>>x[i],p[i]=make_pair(x[i],i);
    sort(p,p+n);
    rep(i,n)ans[x[i]]=i+1;
    
    rep(i,n){
        tmp=p[i].second;
        ll le,ri;
        le=tmp;
        ri=n-tmp-1;
        ll cntt=0;
        rrep(j,1,x[tmp]){
            if(cntt==le)break;
            if(ans[j]==0)ans[j]=tmp+1,cntt++;
        }
        cntt=0;
        rrrep(j,n*n,x[tmp]+1){
            if(cntt==ri)break;
            if(ans[j]==0)ans[j]=tmp+1,cntt++;
        }
    }
    

    rrep(i,1,n*n+1){
        cou[ans[i]]++;
        mp[{ans[i],cou[ans[i]]}]=i;
    }
    rep(i,n){
        if(mp[{i+1,i+1}]!=x[i]){
            Cout("No");
            return 0;
        }
    }

    rrep(i,1,n*n+1){
        if(ans[i]==0){
            Cout("No");
            return 0;
        }
    }

    rrep(i,1,n*n+1){
        couu[ans[i]]++;
    }
    rrep(i,1,n+1){
        if(couu[i]!=n){
            Cout("No");
            return 0;
        }
    }
    
    Cout("Yes");
    rrep(i,1,n*n+1){
        if(i==n*n)Cout(ans[i]);
        else cout<<ans[i]<<" ";
    }
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:40:12: error: incompatible types in assignment of 'long long int' to 'll [1000000]' {aka 'long long int [1000000]'}
   40 |         tmp=p[i].second;
      |         ~~~^~~~~~~~~~~~
a.cc:42:12: error: invalid conversion from 'll*' {aka 'long long int*'} to 'll' {aka 'long long int'} [-fpermissive]
   42 |         le=tmp;
      |            ^~~
      |            |
      |            ll* {aka long long int*}
a.cc:43:13: error: invalid operands of types 'll' {aka 'long long int'} and 'll [1000000]' {aka 'long long int [1000000]'} to binary 'operator-'
   43 |         ri=n-tmp-1;
      |            ~^~~~
      |            | |
      |            | ll [1000000] {aka long long int [1000000]}
      |            ll {aka long long int}
a.cc:45:19: error: invalid types 'll [1000000] {aka long long int [1000000]}[ll [1000000] {aka long long int [1000000]}]' for array subscript
   45 |         rrep(j,1,x[tmp]){
      |                   ^
a.cc:8:37: note: in definition of macro 'rrep'
    8 | #define rrep(i,a,b) for(ll i=(a);i<(b);i++)
      |                                     ^
a.cc:47:36: error: invalid conversion from 'll*' {aka 'long long int*'} to 'll' {aka 'long long int'} [-fpermissive]
   47 |             if(ans[j]==0)ans[j]=tmp+1,cntt++;
      |                                 ~~~^~
      |                                    |
      |                                    ll* {aka long long int*}
a.cc:50:22: error: invalid types 'll [1000000] {aka long long int [1000000]}[ll [1000000] {aka long long int [1000000]}]' for array subscript
   50 |         rrrep(j,n*n,x[tmp]+1){
      |                      ^
a.cc:9:39: note: in definition of macro 'rrrep'
    9 | #define rrrep(i,a,b) for(ll i=(a);i>=(b);i--)
      |                                       ^
a.cc:52:36: error: invalid conversion from 'll*' {aka 'long long int*'} to 'll' {aka 'long long int'} [-fpermissive]
   52 |             if(ans[j]==0)ans[j]=tmp+1,cntt++;
      |                                 ~~~^~
      |                                    |
      |                                    ll* {aka long long int*}