結果

問題 No.1373 Directed Operations
ユーザー pyonthpyonth
提出日時 2021-02-06 00:45:05
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,161 bytes
コンパイル時間 2,469 ms
コンパイル使用メモリ 203,092 KB
実行使用メモリ 4,460 KB
最終ジャッジ日時 2023-09-15 11:05:24
合計ジャッジ時間 7,533 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
4,384 KB
testcase_02 WA -
testcase_03 AC 10 ms
4,384 KB
testcase_04 AC 12 ms
4,408 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 19 ms
4,412 KB
testcase_10 AC 16 ms
4,380 KB
testcase_11 AC 5 ms
4,380 KB
testcase_12 AC 17 ms
4,384 KB
testcase_13 AC 3 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 <bits/stdc++.h>
using namespace std;
#define repl(i, l, r) for (ll i = (l); i < (r); i++)
#define rep(i, n) repl(i, 0, n)
#define CST(x) cout << fixed << setprecision(x)
using ll = long long;
constexpr ll MOD = 1000000007;
constexpr int inf = 1e9 + 10;
constexpr ll INF = (ll)4e18 + 10;
constexpr int dx[9] = {1, 0, -1, 0, 1, -1, -1, 1, 0};
constexpr int dy[9] = {0, 1, 0, -1, 1, 1, -1, -1, 0};
template <typename T>
inline bool chmax(T &a, T b) {
    return ((a < b) ? (a = b, true) : (false));
}
template <typename T>
inline bool chmin(T &a, T b) {
    return ((a > b) ? (a = b, true) : (false));
}
int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    pair<int, int> a[n - 1];
    rep(i, n - 1) {
        cin >> a[i].first;
        a[i].second = i;
    }
    sort(a, a + n - 1, greater<pair<int, int>>());
    vector<int> ans(n - 1);
    rep(i, n - 1) {
        if (i + a[i].first >= n) {
            cout << "NO" << endl;
            return 0;
        }
        ans[a[i].second] = i + 1;
    }
    rep(i, n - 1) cout << "YES" << endl;
    rep(i, n - 1) cout << ans[i] << endl;

    return 0;
}
0