Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cmath>
- #include <cstdio>
- #include <vector>
- #include <iostream>
- #include <algorithm>
- using namespace std;
- int main() {
- int a;
- cin>>a;
- bool n=1;
- int y;
- int x ,s;
- for(int k=0;k<a;k++){
- n = 1;
- cin>>y;
- int c[y];
- string w;
- for(int i=0;i<y;i++){
- cin>>w;
- c[i] = atoi(w.c_str());
- for(int j=0;j<y/2;j++){
- if(w[j] != w[y-(j+1)]){
- n = 0;
- break;
- }
- }
- }
- for(int i=0;i<y/2;i++){
- if(c[i] != c[y - (i+1)]){
- n = 0;
- break;
- }
- }
- if(n == 1){
- cout<<"YES"<<endl;
- }
- else{
- cout<<"NO"<<endl;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement