#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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1584 KB |
Output is correct |
2 |
Correct |
0 ms |
1848 KB |
Output is correct |
3 |
Correct |
2 ms |
1716 KB |
Output is correct |
4 |
Correct |
3 ms |
3300 KB |
Output is correct |
5 |
Correct |
4 ms |
3168 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
166 ms |
38148 KB |
Output is correct |
2 |
Correct |
143 ms |
30756 KB |
Output is correct |
3 |
Correct |
61 ms |
3168 KB |
Output is correct |
4 |
Correct |
39 ms |
1584 KB |
Output is correct |
5 |
Correct |
182 ms |
43692 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Memory limit exceeded |
553 ms |
131072 KB |
Memory limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Halted |
0 ms |
0 KB |
- |