# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
959193 |
2024-04-07T15:57:21 Z |
lalig777 |
Savez (COCI15_savez) |
C++14 |
|
344 ms |
37432 KB |
#include <iostream>
#include <vector>
#include <unordered_map>
using namespace std;
int main(){
unordered_map<string, int>xd;
int n;
cin>>n;
vector<string>v(n+1);
v[0]="";
vector<int>dp(n+1, 1);
int ans=0;
for (int i=1; i<=n; i++){
cin>>v[i];
int siz2=v[i].size();
string s, s2;
for (int j=0; j<siz2; j++){
s+=v[i][j];
s2=v[i][siz2-1-j]+s2;
if (s!=s2) continue;
if (xd.find(s)!=xd.end()){
dp[i]=max(dp[i], dp[xd[s]]+1);
}
}xd[v[i]]=i;
ans=max(ans, dp[i]);
}cout<<ans<<endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
440 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
6 ms |
600 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
281 ms |
3220 KB |
Output is correct |
2 |
Correct |
290 ms |
3140 KB |
Output is correct |
3 |
Correct |
344 ms |
3364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
600 KB |
Output is correct |
2 |
Correct |
180 ms |
3200 KB |
Output is correct |
3 |
Correct |
230 ms |
3408 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
86 ms |
3152 KB |
Output is correct |
2 |
Correct |
88 ms |
3168 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
88 ms |
3700 KB |
Output is correct |
2 |
Correct |
87 ms |
3664 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
79 ms |
4580 KB |
Output is correct |
2 |
Correct |
80 ms |
4436 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
90 ms |
5132 KB |
Output is correct |
2 |
Correct |
80 ms |
5208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
98 ms |
10016 KB |
Output is correct |
2 |
Correct |
88 ms |
9812 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
115 ms |
15660 KB |
Output is correct |
2 |
Correct |
117 ms |
15800 KB |
Output is correct |
3 |
Correct |
207 ms |
37432 KB |
Output is correct |