#include<iostream>
#include<set>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
string A,B;
set<vector<short>> S;
int main()
{
cin>>A>>B;
for(int i=0;i<A.size();i++)
{
vector<short> p(26,0);
for(int j=i;j<A.size();j++)
{
p[A[j]-'a']++;
S.insert(p);
}
}
int ans=0;
for(int i=0;i<B.size();i++)
{
vector<short> p(26,0);
for(int j=i;j<B.size();j++)
{
p[B[j]-'a']++;
auto it=S.find(p);
if(it!=S.end()) ans=max(ans,j-i+1);
}
}
cout<<ans;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1720 KB |
Output is correct |
2 |
Correct |
0 ms |
1720 KB |
Output is correct |
3 |
Correct |
2 ms |
1720 KB |
Output is correct |
4 |
Correct |
0 ms |
2248 KB |
Output is correct |
5 |
Correct |
3 ms |
2248 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
71 ms |
11224 KB |
Output is correct |
2 |
Correct |
92 ms |
13732 KB |
Output is correct |
3 |
Correct |
50 ms |
2248 KB |
Output is correct |
4 |
Correct |
41 ms |
1720 KB |
Output is correct |
5 |
Correct |
106 ms |
15712 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
472 ms |
59140 KB |
Output is correct |
2 |
Correct |
454 ms |
61120 KB |
Output is correct |
3 |
Correct |
469 ms |
60460 KB |
Output is correct |
4 |
Correct |
452 ms |
59140 KB |
Output is correct |
5 |
Correct |
406 ms |
60988 KB |
Output is correct |
6 |
Correct |
436 ms |
59404 KB |
Output is correct |
7 |
Correct |
443 ms |
60988 KB |
Output is correct |
8 |
Correct |
423 ms |
61120 KB |
Output is correct |
9 |
Correct |
446 ms |
61120 KB |
Output is correct |
10 |
Correct |
443 ms |
60856 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
616 ms |
24424 KB |
Output is correct |
2 |
Execution timed out |
1000 ms |
125932 KB |
Program timed out |
3 |
Halted |
0 ms |
0 KB |
- |