Advertisement
jbn6972

Untitled

Nov 9th, 2022
645
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.27 KB | None | 0 0
  1. // Code Written by : John Nixon
  2. // Date: 09:11:2022  Time: 20:00:35
  3. // Copyrights are applicable
  4. #include <bits/stdc++.h>
  5. using namespace std;
  6. #define int long long int
  7. #define mod 1e9 + 7
  8. #define F first
  9. #define S second
  10. #define pb push_back
  11. #define si set<int>
  12. #define vi vector<int>
  13. #define pii pair<int, int>
  14. #define vpi vector<pii>
  15. #define vpp vector<pair<int, pii>>
  16. #define mii map<int, int>
  17. #define mpi map<pii, int>
  18. #define spi set<pii>
  19. #define endl "\n"
  20. #define sz(x) ((int)x.size())
  21. #define all(p) p.begin(), p.end()
  22. #define double long double
  23. #define que_max priority_queue<int>
  24. #define que_min priority_queue<int, vi, greater<int>>
  25. #define bug(...) __f(#__VA_ARGS__, __VA_ARGS__)
  26. #define print(a)          \
  27.     for (auto x : a)      \
  28.         cout << x << " "; \
  29.     cout << endl
  30. #define print1(a)    \
  31.     for (auto x : a) \
  32.     cout << x.F << " " << x.S << endl
  33. #define print2(a, x, y)         \
  34.     for (int i = x; i < y; i++) \
  35.         cout << a[i] << " ";    \
  36.     cout << endl
  37. inline int power(int a, int b)
  38. {
  39.     int x = 1;
  40.     while (b)
  41.     {
  42.         if (b & 1)
  43.             x *= a;
  44.         a *= a;
  45.         b >>= 1;
  46.     }
  47.     return x;
  48. }
  49.  
  50. template <typename Arg1>
  51. void __f(const char *name, Arg1 &&arg1) { cout << name << " : " << arg1 << endl; }
  52. template <typename Arg1, typename... Args>
  53. void __f(const char *names, Arg1 &&arg1, Args &&...args)
  54. {
  55.     const char *comma = strchr(names + 1, ',');
  56.     cout.write(names, comma - names) << " : " << arg1 << " | ";
  57.     __f(comma + 1, args...);
  58. }
  59. const int N = 200005;
  60. void solve()
  61. {
  62.     int n;
  63.     string s;
  64.     cin>>n;
  65.     cin>>s;
  66.  
  67.     string A = "",B= "";
  68.     for(int i = 0;i<n;i++){
  69.         if(i < n/2){
  70.             A += s[i];
  71.         }
  72.         else{
  73.             B += s[i];
  74.         }
  75.     }
  76.  
  77.     if(A+B == s && B+A == s){
  78.         cout<<"YES"<<endl;
  79.     }else{
  80.         cout<<"NO"<<endl;
  81.     }
  82. }
  83. int32_t main()
  84. {
  85.     ios_base::sync_with_stdio(0);
  86.     cin.tie(0);
  87.     cout.tie(0);
  88. #ifndef ONLINE_JUDGE
  89.     freopen("input.txt", "r", stdin);
  90.     freopen("output.txt", "w", stdout);
  91. #endif
  92.     clock_t z = clock();
  93.     int t = 1;
  94.     cin >> t;
  95.     while (t--)
  96.         solve();
  97.     cerr << "Run Time : " << ((double)(clock() - z) / CLOCKS_PER_SEC);
  98.     return 0;
  99. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement