結果
| 問題 |
No.1373 Directed Operations
|
| コンテスト | |
| ユーザー |
ocvret_
|
| 提出日時 | 2021-02-05 21:45:30 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 49 ms / 2,000 ms |
| コード長 | 630 bytes |
| コンパイル時間 | 1,733 ms |
| コンパイル使用メモリ | 173,852 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-02 11:57:41 |
| 合計ジャッジ時間 | 3,586 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 19 |
ソースコード
#include<bits/stdc++.h>
// #include<atcoder/all>
using namespace std;
// using namespace atcoder;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
#define rep(i,n) for(ll i = 0;i < (ll)n;i++)
#define ALL(x) (x).begin(),(x).end()
#define MOD 1000000007
int main(){
int n;
cin >> n;
vector<P> a(n-1);
rep(i,n-1)cin >> a[i].first,a[i].second = i;
sort(ALL(a));
vector<int> res(n-1);
rep(i,n-1){
if(a[i].first < i+2)res[a[i].second] = i+2-a[i].first;
else{
cout << "NO\n";
return 0;
}
}
cout << "YES\n";
rep(i,n-1)cout << res[i] << "\n";
return 0;
}
ocvret_