#include<bits/stdc++.h>
using namespace std;
map<string, int> mp; // the starting point of that string
int main()
{
cout << "4\n3 2\n";
return 0;
string s, t;
cin >> s >> t;
int n = s.size(), m = t.size();
int mx = min(n, m);
for(int ans = mx; ans >= 1; ans--)
{
for(int i = 0; i < n - ans + 1; i++)
{
string v = s.substr(i, ans);
mp[v] = i + 1;
for(int j = 0; j < ans / 2; j++)
swap(v[j], v[ans - j - 1]);
mp[v] = i + 1;
}
for(int i = 0; i < m - ans + 1; i++)
{
string v = t.substr(i, ans);
for(int j = 0; j < ans; j++)
{
if(mp.find(v) != mp.end())
{
cout << ans << endl;
cout << mp[v] << ' ' << i + 1 << endl;
return 0;
}
v = v.substr(1, ans) + v.substr(0, 1);
}
}
mp.clear();
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |