# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
40710 | 2018-02-06T20:00:57 Z | Hassoony | Savez (COCI15_savez) | C++14 | 1000 ms | 53048 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; 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=""; for(int j=s[i].size()-1;j>=0;j--){ tmp+=s[i][j]; if(good1[tmp]){ tk[tmp]=max(tk[tmp],tk[s[i]]+1); } } tmp=""; for(auto pp:s[i]){ tmp+=pp; good1[tmp]=0; } } cout<<ans+1<<endl; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 248 KB | Output is correct |
2 | Correct | 2 ms | 352 KB | Output is correct |
3 | Incorrect | 2 ms | 532 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 532 KB | Output is correct |
2 | Correct | 2 ms | 532 KB | Output is correct |
3 | Correct | 218 ms | 53048 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1075 ms | 53048 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 71 ms | 53048 KB | Output is correct |
2 | Execution timed out | 1070 ms | 53048 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 542 ms | 53048 KB | Output is correct |
2 | Correct | 526 ms | 53048 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 367 ms | 53048 KB | Output is correct |
2 | Correct | 356 ms | 53048 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 293 ms | 53048 KB | Output is correct |
2 | Correct | 279 ms | 53048 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 247 ms | 53048 KB | Output is correct |
2 | Correct | 298 ms | 53048 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 263 ms | 53048 KB | Output is correct |
2 | Correct | 240 ms | 53048 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 252 ms | 53048 KB | Output is correct |
2 | Correct | 256 ms | 53048 KB | Output is correct |
3 | Correct | 340 ms | 53048 KB | Output is correct |