Submission #51638

#TimeUsernameProblemLanguageResultExecution timeMemory
51638okaybody10구간 성분 (KOI15_interval)C++98
61 / 100
1072 ms172188 KiB
#include <bits/stdc++.h> using namespace std; typedef vector<int> vi; set<vi> gg; int main() { string s1,s2; cin>>s1>>s2; int l1=s1.size(),l2=s2.size(); for(int i=l1;i>0;i--) { vi alpha(26); int s=0,e=i-1; for(int j=s;j<=e;j++) alpha[s1[j]-'a']++; while(e<l1) { gg.insert(alpha); if(++e<l1) alpha[s1[e]-'a']++,alpha[s1[s++]-'a']--; } } for(int i=l2;i>0;i--) { vi alpha(26); int s=0,e=i-1; for(int j=s;j<=e;j++) alpha[s2[j]-'a']++; while(e<l2) { if(gg.count(alpha)) return !printf("%d",i); if(++e<l2) alpha[s2[e]-'a']++,alpha[s2[s++]-'a']--; } } return !printf("0"); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...