Lucky, this time CF Rose, incredibly is the room second (but if the D problem tle, on the first)
Use String to Tle, add subscript with char, and see more bull algorithm,
1#include <iostream>2#include <cstdio>3#include <cstring>4 using namespacestd;5 Const intmaxx=200010;6 CharA[maxx],b[maxx];7 BOOLcmpintP1,intP2,intlen)8 {9 for(intI=0; i<len;i++)Ten if(A[I+P1]!=B[I+P2])return 0; One return 1; A } - BOOLJudgeintP1,intP2,intlen) - { the BOOLflag=CMP (P1,p2,len); - if(flag==1)return 1; - if(len&1)return 0; -Len/=2; + if(((Judge (P1,p2,len)) && (judge (p1+len,p2+Len,len ))) -|| (Judge (P1,p2+len,len) &&judge (p1+Len,p2,len ))) + return 1; A return 0; at } - intMain () - { -scanf"%s%s", A, b); - if(Judge (0,0, strlen (a))) printf ("yes\n"); - Elseprintf"no\n"); in}
I've been a little busy lately, so I don't write.
1#include <bits/stdc++.h>2 using namespacestd;3 stringGosort (strings)4 {5 if(S.size ()%2)returns;6 stringS1 = Gosort (S.substr (0, S.size ()/2 )) ;7 stringS2 = Gosort (S.substr (S.size ()/2, S.size ())) ;8 if(S1 < S2)returnS1 +S2;9 Else returnS2 +S1;Ten } One intMain () A { - stringA, B; -Cin >> a >>b; the if(Gosort (a) = = Gosort (b)) puts ("YES") ; - ElsePuts ("NO") ; - return 0 ; -}
Round #313 (Div. 2) D. Equivalent Strings