답안 #928754

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
928754 2024-02-17T04:25:49 Z Faisal_Saqib Necklace (Subtask 1-3) (BOI19_necklace1) C++17
0 / 85
589 ms 109636 KB
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
using namespace std;
int main()
{
    string a,b;
    cin>>a>>b;
    map<deque<char>,int> fpp;
    int n=a.size();
    for(int i=0;i<n;i++)
    {
        deque<char> tp;
        for(int j=i;j<n;j++)
        {
            tp.push_back(a[j]);
            deque<char> lp=tp;
            deque<char> lp1=tp;
            reverse(begin(lp1),end(lp1));
            for(int l=0;l<(j-i+1);l++)
            {
                fpp[lp]=1;
                fpp[lp1]=1;
                char f=lp.front();
                lp.pop_front();
                lp.push_back(f);
                f=lp1.front();
                lp1.pop_front();
                lp1.push_back(f);
            }
        }
    }
    int m=b.size();
    int mx=0;
    int ip=-1;
    int jp=-1;
    for(int i=0;i<m;i++)
    {
        deque<char> tp;
        for(int j=i;j<m;j++)
        {
            tp.push_back(b[j]);
            if(fpp.find(tp)!=fpp.end())
            {
                if((int)(tp.size())>mx)
                {
                    mx=(int)(tp.size());
                    ip=fpp[tp];
                    jp=i;
                }
            }
        }
    }
    cout<<mx<<endl;
    cout<<ip<<' '<<jp<<endl;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 589 ms 109636 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 589 ms 109636 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 589 ms 109636 KB Output isn't correct
2 Halted 0 ms 0 KB -