結果

問題 No.1373 Directed Operations
ユーザー 👑 PCTprobabilityPCTprobability
提出日時 2021-02-05 21:34:47
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,564 bytes
コンパイル時間 4,095 ms
コンパイル使用メモリ 265,112 KB
実行使用メモリ 5,656 KB
最終ジャッジ日時 2023-09-15 07:18:55
合計ジャッジ時間 7,161 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
4,380 KB
testcase_02 WA -
testcase_03 AC 10 ms
4,612 KB
testcase_04 AC 14 ms
4,724 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 21 ms
5,416 KB
testcase_10 AC 18 ms
5,144 KB
testcase_11 AC 6 ms
4,380 KB
testcase_12 AC 18 ms
4,976 KB
testcase_13 AC 4 ms
4,376 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
#endif
using ll = long long;
using ld = long double;
#define all(s) (s).begin(),(s).end()
#define vcin(n) for(ll i=0;i<ll(n.size());i++) cin>>n[i]
#define rep2(i, m, n) for (int i = (m); i < (n); ++i)
#define rep(i, n) rep2(i, 0, n)
#define drep2(i, m, n) for (int i = (m)-1; i >= (n); --i)
#define drep(i, n) drep2(i, n, 0)
#define rever(vec) reverse(vec.begin(), vec.end())
#define sor(vec) sort(vec.begin(), vec.end())
#define fi first
#define se second
//const ll mod = 998244353;
const ll mod = 1000000007;
const ll inf = 2000000000000000000ll;
static const long double pi = 3.141592653589793;
template<class T,class U> void chmax(T& t,const U& u){if(t<u) t=u;}
template<class T,class U> void chmin(T& t,const U& u){if(t>u) t=u;}
ll modPow(ll a, ll n, ll mod) { ll ret = 1; ll p = a % mod; while (n) { if (n & 1) ret = ret * p % mod; p = p * p % mod; n >>= 1; } return ret; }

int main() {
  /* mod は 1e9+7 */
  ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
  cout<< fixed << setprecision(10);
  ll n;
  cin>>n;
  vector<pair<ll,ll>> a(n-1);
  for(int i=0;i<n-1;i++){
    cin>>a[i].first;
    a[i].second=i;
  }
  sor(a);
  if(a[0].first!=1){
    cout<<"NO"<<endl;
    return 0;
  }
  vector<ll> ans(n-1);
  for(int i=0;i<n-1;i++){
    ans[a[i].second]=i-a[i].first+2;
    if(i-a[i].first<=0){
      cout<<"NO"<<endl;
      return 0;
    }
  }
  cout<<"YES"<<endl;
  for(int i=0;i<n-1;i++){
    cout<<ans[i]<<endl;
  }
}
0