Advertisement
hkshakib

Untitled

Jun 22nd, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1.  
  2. #include<bits/stdc++.h>
  3. using namespace std;
  4. #define lli long long int
  5. int main()
  6. {
  7.  
  8. int n;
  9. cin >> n;
  10. lli arr[n];
  11. lli s = 0;
  12. for(int i = 0; i < n; i++)
  13. {
  14. cin >> arr[i];
  15. if(arr[i] >= 0)
  16. {
  17. arr[i] = -arr[i] - 1;
  18. }
  19. if(arr[i] < arr[s])
  20. s = i;
  21. }
  22.  
  23. if(n & 1)
  24. arr[s] = -arr[s] - 1;
  25.  
  26. for(int i = 0; i < n; i++)
  27. cout << arr[i] << " ";
  28. cout << endl;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement