Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- #define ll long long
- #define nl "\n"
- void files(){
- ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);
- #ifndef ONLINE_JUDGE
- freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);
- #endif
- }
- bool pali(string s){
- string t = s;
- reverse(t.begin(), t.end());
- return s == t;
- }
- void solve(){
- int n; cin>>n;
- vector<string> v(n);
- for(int i=0; i<n; i++) cin>>v[i];
- for(int i=0;i<n;i++){
- for(int j=i+1;j<n;j++){
- if(pali(v[i]+v[j]) || pali(v[j]+v[i])){
- cout<<"Yes\n";
- return;
- }
- }
- }
- cout<<"No\n";
- }
- int main(){
- files();
- int t = 1;
- // cin>>t;
- while(t--) solve();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement