Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- using namespace std;
- int main(){
- int n;
- cin>>n;
- vector<int> t(n);
- for (int i=0; i<n; i++){
- cin>>t[i];
- if (t[i]<0){
- t[i]=(-1)*t[i];
- }
- }
- int x=-1;
- bool flag=true;
- for (int i=0; i<n-1; i++){
- if (t[i]>t[i+1]){
- if (x==i-1){
- x=i;
- }else{
- flag=false;
- }
- }
- if (t[i]==t[i+1]){
- if (x==i-1){
- x=i;
- }
- }
- }
- if (!flag){
- cout<<"No"<<"\n";
- return 0;
- }
- cout<<"Yes"<<"\n";
- for (int i=0; i<n; i++){
- if (i<=x){
- cout<<-t[i]<<" ";
- }else{
- cout<<t[i]<<" ";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement