답안 #439282

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
439282 2021-06-29T13:32:24 Z Haidara 원형 문자열 (IZhO13_rowords) C++17
12 / 100
54 ms 53172 KB
/* * * * * * * * * *
 *   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;
int dp[maxn][maxn];
signed main()
{
    SIO("");
    string s,l;
    cin>>s>>l;
    s+=s;
    l+=l;
    int n=s.size(),m=l.size();
    rep(i,1,n+1)
        rep(j,1,m+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]);
    int ans=0;
    FOR(i,n/2)
        FOR(j,m/2)
            ans=max(dp[i+n/2-1][j+m/2-1]-dp[i][j],ans);
    cout<<ans;
}

Compilation message

rowords.cpp: In function 'void SIO(std::string)':
rowords.cpp:27:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   27 |         freopen((name+".in").c_str(),"r",stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
rowords.cpp:28:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   28 |         freopen((name+".out").c_str(),"w",stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Incorrect 1 ms 336 KB Output isn't correct
3 Correct 1 ms 464 KB Output is correct
4 Correct 1 ms 716 KB Output is correct
5 Incorrect 1 ms 588 KB Output isn't correct
6 Incorrect 9 ms 11468 KB Output isn't correct
7 Correct 41 ms 39660 KB Output is correct
8 Incorrect 30 ms 39620 KB Output isn't correct
9 Incorrect 34 ms 39616 KB Output isn't correct
10 Incorrect 38 ms 39620 KB Output isn't correct
11 Incorrect 44 ms 43588 KB Output isn't correct
12 Incorrect 32 ms 50060 KB Output isn't correct
13 Incorrect 46 ms 50116 KB Output isn't correct
14 Incorrect 41 ms 45376 KB Output isn't correct
15 Incorrect 54 ms 53032 KB Output isn't correct
16 Incorrect 42 ms 43432 KB Output isn't correct
17 Incorrect 36 ms 37828 KB Output isn't correct
18 Incorrect 53 ms 53172 KB Output isn't correct
19 Incorrect 40 ms 39620 KB Output isn't correct
20 Incorrect 39 ms 47556 KB Output isn't correct
21 Incorrect 19 ms 22064 KB Output isn't correct
22 Incorrect 28 ms 28868 KB Output isn't correct
23 Incorrect 30 ms 34496 KB Output isn't correct
24 Incorrect 34 ms 36456 KB Output isn't correct
25 Incorrect 42 ms 44588 KB Output isn't correct