結果

問題 No.1373 Directed Operations
ユーザー t33ft33f
提出日時 2021-02-05 21:56:46
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 423 bytes
コンパイル時間 719 ms
コンパイル使用メモリ 79,340 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-15 08:07:30
合計ジャッジ時間 4,253 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <algorithm>
#include <vector>
#include <iostream>
using namespace std;
int main() {
    int n; cin >> n;
    int a[n-1]; for (int i = 0; i < n-1; i++) cin >> a[i];
    sort(a, a+n-1);
    vector<int> ans;
    for (int i = 0; i < n-1; i++) {
        if (i + 2 - a[i] <= 0) { cout << "NO\n"; return 0; }
        else ans.push_back(i + 2 - a[i]);
    }
    cout << "YES\n";
    for (int x : ans) cout << x << endl;
}
0