# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
439293 | Haidara | Round words (IZhO13_rowords) | C++17 | 2106 ms | 125888 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/* * * * * * * * * *
* ID: Haidara *
* LANG: C++17 *
* PROB: *
* * * * * * * * * */
#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define rep(i,x,n) for(int i=x;i<n;i++)
#define FOR(i,n) rep(i,0,n)
#define per(i,x,n) for(int i=x;i>n;i--)
#define ROF(i,x) for(int i=x;i>=0;i--)
#define v(i) vector< i >
#define p(i,j) pair< i , j >
#define pii pair<int,int>
#define m(i,j) map< i , j >
#define pq(i) priority_queue< i >
#define ff first
#define all(x) x.begin(),x.end()
#define ss second
#define pp push_back
using namespace std;
void SIO(string name="")
{
if(name!="")
{
freopen((name+".in").c_str(),"r",stdin);
freopen((name+".out").c_str(),"w",stdout);
}
}
const int inf=1LL<<60LL;
const int mod=1e9+7;
const int maxn=4004;
signed main()
{
SIO("");
string sss,ll;
cin>>sss>>ll;
sss+=sss;
ll+=ll;
int n=sss.size(),m=ll.size();
int ans=0;
FOR(str1,n)
FOR(str2,m)
{
string s=sss.substr(str1,n/2),l=ll.substr(str2/2);
int dp[maxn][maxn]{};
rep(i,1,n/2+1)
rep(j,1,m/2+1)
if(s[i-1]==l[j-1])
dp[i][j]=dp[i-1][j-1]+1;
else
dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
ans=max(ans,dp[n/2][m/2]);
}
cout<<ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |