# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1043043 |
2024-08-03T19:05:07 Z |
earlyamazon |
Savez (COCI15_savez) |
C++14 |
|
1000 ms |
35940 KB |
// brut S <= 500
#include <bits/stdc++.h>
using namespace std;
const int mn = 1e6+7;
int n,wyn;
string t[mn];
int dp[mn];
bool czy1w2(string s1, string s2){
if (s1.size() > s2.size()) return 0;
for (int i = 0; i < (int)s1.size(); i++){
if (s1[i] != s2[i] || s1[s1.size()-i-1] != s2[s2.size()-i-1]) return 0;
}
return 1;
}
int main(){
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin>>n;
for (int i = 0; i < n; i++){
cin>>t[i];
}
for (int i = 0; i < n; i++){
dp[i] = 1;
for (int j = 0; j < i; j++){
if (czy1w2(t[j], t[i])){
dp[i] = max(dp[j]+1, dp[i]);
}
}
wyn = max(wyn, dp[i]);
}
cout<<wyn<<"\n";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
33372 KB |
Output is correct |
2 |
Correct |
12 ms |
33372 KB |
Output is correct |
3 |
Correct |
11 ms |
33364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
33372 KB |
Output is correct |
2 |
Correct |
15 ms |
33372 KB |
Output is correct |
3 |
Correct |
14 ms |
33628 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
163 ms |
35420 KB |
Output is correct |
2 |
Correct |
124 ms |
35420 KB |
Output is correct |
3 |
Correct |
170 ms |
35420 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
19 ms |
33372 KB |
Output is correct |
2 |
Correct |
117 ms |
35268 KB |
Output is correct |
3 |
Correct |
74 ms |
35420 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1082 ms |
35416 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1060 ms |
35676 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1016 ms |
35928 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1059 ms |
35940 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1061 ms |
34640 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1024 ms |
34824 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |