結果

問題 No.1373 Directed Operations
ユーザー zuminzumin
提出日時 2021-02-23 21:34:50
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 427 bytes
コンパイル時間 702 ms
コンパイル使用メモリ 74,308 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-23 22:30:57
合計ジャッジ時間 5,470 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 145 ms
4,348 KB
testcase_03 AC 18 ms
4,348 KB
testcase_04 AC 31 ms
4,348 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 165 ms
4,348 KB
testcase_07 AC 5 ms
4,348 KB
testcase_08 AC 19 ms
4,348 KB
testcase_09 AC 37 ms
4,348 KB
testcase_10 AC 31 ms
4,348 KB
testcase_11 AC 9 ms
4,348 KB
testcase_12 AC 31 ms
4,348 KB
testcase_13 AC 6 ms
4,348 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
    int n;
    cin>>n;
    vector<int> a(n-1);
    for(int i=1;i<n;i++) cin>>a[i-1];
    sort(a.begin(),a.end());
    for(int i=1;i<n;i++){
        if(a[i-1]>i){
            cout<<"NO"<<endl;
            return 0;
        }
    }
    cout<<"YES"<<endl;
    for(int i=1;i<n;i++){
        cout<<i+1-a[i-1]<<endl;
    }

    return 0;
}
0