結果

問題 No.1373 Directed Operations
ユーザー umezo
提出日時 2021-02-05 22:54:42
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 484 bytes
コンパイル時間 2,107 ms
コンパイル使用メモリ 197,140 KB
最終ジャッジ日時 2025-01-18 12:51:41
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 12 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;

#include <bits/stdc++.h>
using namespace std;

int main(){
  int n;
  cin>>n;
  
  bool b=true;
  vector<int> A(n-1),B(n-1);
  rep(i,n-1) cin>>A[i];
  sort(ALL(A));
  rep(i,n-1){
    if(i+1-A[i]<0){
      b=false;
      break;
    }
    B[i]=i+2-A[i];
  }
  if(b==false){
    cout<<"NO"<<endl;
    return 0;
  }
  
  cout<<"YES"<<endl;
  rep(i,n-1) cout<<B[i]<<endl;
  
  return 0;
}
0