fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. const int maxn=1e7+14;
  4. int a[maxn];
  5. void solve(){
  6. int n;
  7. cin >> n;
  8. for (int i = 1; i <= n; i++){
  9. cin >> a[i];
  10. }
  11. bool ok = 1;
  12. for (int i = 1; i <= n/2; i++){
  13. if (a[i] != a[n - i + 1]) {
  14. ok = 0;
  15. break;
  16. }
  17. }
  18.  
  19. cout << ok;
  20. }
  21. int main(){
  22. ios_base::sync_with_stdio(0);
  23. cin.tie(0); cout.tie(0);
  24. if (fopen("input.txt","r")) {
  25. freopen("input.txt","r",stdin);
  26. freopen("output.txt","w",stdout);
  27. }
  28. solve();
  29. return 0;
  30. }
  31.  
Success #stdin #stdout 0.01s 5280KB
stdin
0 0 0
stdout
1