This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
int n,m,res;
char arr1[1510],arr2[1510];
vector<int> vt(26);
map <vector <int> ,bool> mp;
void vector_init(){
int i;
for(i=0;i<26;i++) vt[i]=0;
}
int main(){
int i,j;
scanf("%s %s",arr1,arr2); n=strlen(arr1); m=strlen(arr2);
for(i=0;i<n;i++){
for(j=i;j<n;j++){
vt[arr1[j]-'a']++; mp[vt]=1;
}
vector_init();
}
for(i=0;i<m;i++){
for(j=i;j<m;j++){
vt[arr2[j]-'a']++; if(mp[vt]==1) res=max(res,j-i+1);
}
vector_init();
}
printf("%d",res);
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |