fork download
  1. #include <iostream>
  2. #include <cmath>
  3. #include <algorithm>
  4.  
  5. using namespace std;
  6.  
  7. int main() {
  8. ios_base::sync_with_stdio(0);
  9. cin.tie(0);
  10. cout.tie(0);
  11.  
  12. int A;
  13. long long arr[1001];
  14. bool B = false;
  15.  
  16. cin >> A;
  17.  
  18. for ( int i = 0 ; i < A ; i++ ) {
  19. cin >> arr[i];
  20. }
  21.  
  22. for ( int i = 0 ; i < A / 2 ; i++ ) {
  23. if ( arr[i] != arr[A-i-1] ) {
  24. B = true;
  25. }
  26. }
  27. if ( B == false ) {
  28. cout <<"YES";
  29. }
  30. else {
  31. cout <<"NO";
  32. }
  33.  
  34. return 0;
  35. }
  36.  
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
YES