# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
40706 | 2018-02-06T19:51:20 Z | Hassoony | Savez (COCI15_savez) | C++14 | 1000 ms | 24676 KB |
#include <stdio.h> #include <stdlib.h> #include<bits/stdc++.h> using namespace std; typedef long long ll; typedef double D; const ll inf=(1ll<<61); const ll mod=1e9+7; const int MX=2e6+9; int n,ans; char oo[MX]; vector<string>s; string v,tmp=""; unordered_map<string,int>tk; unordered_map<string,bool>good1,good2; int main(){ scanf("%d",&n); for(int i=0;i<n;i++){ scanf("%s",&oo); v=oo; s.push_back(v); } for(int i=n-1;i>=0;i--){ ans=max(ans,tk[s[i]]); tmp=""; for(auto pp:s[i]){ tmp+=pp; good1[tmp]=1; } tmp=""; reverse(s[i].begin(),s[i].end()); for(auto pp:s[i]){ tmp+=pp; good2[tmp]=1; } reverse(s[i].begin(),s[i].end()); for(auto pp:good1){ if(good2[pp.first]){ if(pp.first==s[i]&&s[i].size()!=1)continue; tk[pp.first]=max(tk[pp.first],tk[s[i]]+1); } } //cout<<endl; good1.clear(); good2.clear(); } cout<<ans+1<<endl; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 248 KB | Output is correct |
2 | Incorrect | 2 ms | 356 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 464 KB | Output is correct |
2 | Correct | 2 ms | 636 KB | Output is correct |
3 | Correct | 90 ms | 1360 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1072 ms | 9292 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 77 ms | 9308 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 907 ms | 10756 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 687 ms | 12020 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 499 ms | 13800 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 500 ms | 15392 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 360 ms | 15392 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 385 ms | 24676 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |