Advertisement
Emiliatan

e159

May 4th, 2019
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.72 KB | None | 0 0
  1. /* e159             */
  2. /* AC (5ms, 1000KB) */
  3. #include <iostream>
  4. #include <string>
  5. #define spIO ios::sync_with_stdio(false);cin.tie(0)
  6.  
  7. using namespace std;
  8.  
  9. typedef long long ll;
  10. typedef long double lb;
  11.  
  12. string s1, s2;
  13.  
  14. inline bool e(int st1, int st2, int size)
  15. {
  16.     if (size & 1)
  17.     {
  18.         for (int i = 0; i < size; ++i)
  19.             if (s1[st1 + i] != s2[st2 + i])
  20.                 return false;
  21.         return true;
  22.     }
  23.     return e(st1, st2, size / 2) && e(st1 + size / 2, st2 + size / 2, size / 2) || e(st1 + size / 2, st2, size / 2) && e(st1, st2 + size / 2, size / 2);
  24. }
  25.  
  26. int main()
  27. {
  28.     spIO;
  29.     getline(cin, s1);
  30.     getline(cin, s2);
  31.  
  32.     cout << (e(0, 0, s1.size()) ? "yes" : "no");
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement