Advertisement
theo830

lefkaritika 2017

Apr 29th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. #include <cmath>
  2. #include <cstdio>
  3. #include <vector>
  4. #include <iostream>
  5. #include <algorithm>
  6. using namespace std;
  7. int main() {
  8. int a;
  9. cin>>a;
  10. bool n=1;
  11. int y;
  12. int x ,s;
  13. for(int k=0;k<a;k++){
  14. n = 1;
  15. cin>>y;
  16. int c[y];
  17. string w;
  18. for(int i=0;i<y;i++){
  19. cin>>w;
  20. c[i] = atoi(w.c_str());
  21. for(int j=0;j<y/2;j++){
  22. if(w[j] != w[y-(j+1)]){
  23. n = 0;
  24. break;
  25. }
  26. }
  27. }
  28. for(int i=0;i<y/2;i++){
  29. if(c[i] != c[y - (i+1)]){
  30. n = 0;
  31. break;
  32. }
  33. }
  34.  
  35. if(n == 1){
  36. cout<<"YES"<<endl;
  37. }
  38. else{
  39. cout<<"NO"<<endl;
  40. }
  41. }
  42. return 0;
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement