Submission #959183

#TimeUsernameProblemLanguageResultExecution timeMemory
959183lalig777Savez (COCI15_savez)C++14
48 / 120
1082 ms14564 KiB
#include <iostream> #include <vector> using namespace std; int main(){ int n; cin>>n; vector<string>v(n+1); v[0]=""; vector<int>dp(n+1, 0); int ans=0; for (int i=1; i<=n; i++){ cin>>v[i]; int siz2=v[i].size(); for (int j=0; j<i; j++){ string s=v[j]; int siz=s.size(); bool bien=true; for (int k=0; k<siz; k++){ if (s[k]!=v[i][k] or s[k]!=v[i][siz2-siz+k]){ bien=false; break; } }if (bien==true) dp[i]=max(dp[i], dp[j]+1); }ans=max(ans, dp[i]); }cout<<ans<<endl; return 0; }
#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...