# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
165725 | 2019-11-28T11:51:23 Z | beso123 | Savez (COCI15_savez) | C++14 | 1000 ms | 16632 KB |
#include<bits/stdc++.h> #define int long long using namespace std; string s[100005]; int n,dp[100005]; map<string,int> mp; bool sort12(string a,string b){ return a.size()<b.size(); } main(){ cin>>n; for(int k=1;k<=n;k++){ cin>>s[k]; dp[k]=1; } sort(s+1,s+n+1,sort12); for(int k=1;k<=n;k++){ string a,b; int j=s[k].size()-1; for(int i=0;i<s[k].size();i++){ a+=s[k][i]; b+=s[k][j]; j--; if(a!=b){ break; } else{ //cout<<k<<' '<<s[k]<<' '<<a<<endl; if(mp[a]!=0) dp[k]=1+dp[mp[a]]; } } mp[s[k]]=k; } int ans=0; for(int k=1;k<=n;k++) ans=max(ans,dp[k]); cout<<ans; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 3448 KB | Output is correct |
2 | Incorrect | 5 ms | 3448 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 3448 KB | Output is correct |
2 | Correct | 5 ms | 3452 KB | Output is correct |
3 | Incorrect | 10 ms | 3704 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 885 ms | 8568 KB | Output is correct |
2 | Incorrect | 893 ms | 8632 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 26 ms | 4728 KB | Output is correct |
2 | Execution timed out | 1074 ms | 16632 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 309 ms | 6292 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 224 ms | 6288 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 196 ms | 6648 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 199 ms | 6304 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 58 ms | 9028 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 48 ms | 8824 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |