結果
問題 |
No.1373 Directed Operations
|
ユーザー |
![]() |
提出日時 | 2021-02-05 22:04:00 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 622 bytes |
コンパイル時間 | 1,937 ms |
コンパイル使用メモリ | 198,348 KB |
最終ジャッジ日時 | 2025-01-18 12:23:27 |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 12 WA * 7 |
ソースコード
#include<bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int) n; i++) using ll = long long; using namespace std; const long long INF = 1ll << 60; int main() { ll n; cin >> n; vector<ll> a(n - 1, 0); rep(i, n - 1) cin >> a[i]; sort(a.begin(), a.end()); ll current = 1; vector<ll> log; rep(i, n - 1) { ll j = current + 1 - a[i]; if (j >= 1) { log.push_back(j); current++; } else { cout << "NO" << endl; return 0; } } cout << "YES" << endl; for (auto ai:log) cout << ai << endl; }