# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
366061 | GusMG | Necklace (Subtask 4) (BOI19_necklace4) | C++17 | 1558 ms | 364 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define per(i,a,b) for(int i=(b)-1;i>=(a);i--)
using ll=long long;
int main(){
ios_base::sync_with_stdio(0);
string s,t;
cin>>s>>t;
int n=s.size(),m=t.size(),ans=0,l=0,r=0;
rep(i,0,n) rep(j,i,n) rep(k,j,n) {
string aux=s.substr(j,k-j)+s.substr(i,j-i);
int pos=t.find(aux);
if(pos!=string::npos && aux.size()>ans) ans=aux.size(),l=i,r=pos;
}
reverse(s.begin(),s.end());
rep(i,0,n) rep(j,i,n) rep(k,j,n) {
string aux=s.substr(j,k-j)+s.substr(i,j-i);
int pos=t.find(aux);
if(pos!=string::npos && aux.size()>ans) ans=aux.size(),l=n-k,r=pos;
}
cout<<ans<<"\n";
cout<<l<<" "<<r<<"\n";
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |