제출 #201737

#제출 시각아이디문제언어결과실행 시간메모리
201737mdn2002Savez (COCI15_savez)C++14
0 / 120
1091 ms23580 KiB
#include<bits/stdc++.h> using namespace std; const int mod=1e9+7; vector<string>s; map<string,vector<int> >mp; map<string,int>dp,on; int n; int f(int x) { if(on[s[x]]!=0)return dp[s[x]]; int ans=0; for(int i=0;i<mp[s[x]].size();i++) { int to=mp[s[x]][i]; if(x>=to)continue; ans=max(ans,f(to)+1); } on[s[x]]++; return dp[s[x]]=ans; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); //freopen("empty.in","r",stdin); //freopen("empty.out","w",stdout); cin>>n; for(int k=0;k<n;k++) { string st,pr,sf; cin>>st; for(int i=0,j=st.size()-1;i<st.size();i++,j--) { pr.push_back(st[i]); sf.push_back(st[j]); if(pr==sf)mp[pr].push_back(k); } s.push_back(st); } int ans=0; for(int i=0;i<n;i++)ans=max(ans,f(i)+1); cout<<ans; }

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

savez.cpp: In function 'int f(int)':
savez.cpp:12:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<mp[s[x]].size();i++)
                 ~^~~~~~~~~~~~~~~~
savez.cpp: In function 'int main()':
savez.cpp:33:36: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int i=0,j=st.size()-1;i<st.size();i++,j--)
                                   ~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...