제출 #439288

#제출 시각아이디문제언어결과실행 시간메모리
439288Haidara원형 문자열 (IZhO13_rowords)C++17
16 / 100
47 ms53188 KiB
/* * * * * * * * * * * 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; rep(i,1,n/2+1) rep(j,1,m/2+1) ans=max(dp[i+n/2][j+m/2]-dp[i][j],ans); cout<<ans; }

컴파일 시 표준 에러 (stderr) 메시지

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);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...