結果
| 問題 |
No.1373 Directed Operations
|
| コンテスト | |
| ユーザー |
umezo
|
| 提出日時 | 2021-02-05 23:07:45 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 267 ms / 2,000 ms |
| コード長 | 564 bytes |
| コンパイル時間 | 2,167 ms |
| コンパイル使用メモリ | 201,172 KB |
| 最終ジャッジ日時 | 2025-01-18 12:58:22 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 19 |
ソースコード
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
bool b=true;
vector<pair<int,int>> A(n-1);
vector<int> B(n-1);
rep(i,n-1){
int x;
cin>>x;
A[i]={x,i};
}
sort(ALL(A));
rep(i,n-1){
if(i+1-A[i].first<0){
b=false;
break;
}
B[A[i].second]=i+2-A[i].first;
}
if(b==false){
cout<<"NO"<<endl;
return 0;
}
cout<<"YES"<<endl;
rep(i,n-1) cout<<B[i]<<endl;
return 0;
}
umezo