fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int arr[50];
  6. int N;
  7. bool bandera=true;
  8.  
  9. cin>>N;
  10. for(int i=0;i<N;i++){
  11. cin>>arr[i];
  12. }
  13. if(arr[0]==0){
  14. cout<<"NO"<<endl;
  15. return 0;
  16. }
  17. for(int i=0;i<=(N/2); i++){
  18. if(arr[i]==arr[N-1-i]){
  19. bandera=true;
  20. }
  21. else {
  22. bandera=false;
  23. cout<<"NO"<<endl;
  24. return 0;
  25. }
  26. }
  27. if(bandera==true){
  28. cout<<"SI"<<endl;
  29. }
  30.  
  31. return 0;
  32. }
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
NO