This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#pragma GCC optimize("O3")
#pragma GCC target("avx,avx2,sse,sse2,sse3,sse4,popcnt,fma")
#include "bits/stdc++.h"
#define ll long long
using namespace std;
#define check(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename val1>
void __f(const char* name, val1&& value) {
cout << name << " = " << value << endl;
}
template <typename val1, typename... values>
void __f( const char* names, val1&& value, values&&... multiplevalue)
{
const char* comma = strchr( names + 1, ','); cout.write(names, comma - names) << " = " << value << " "; __f(comma + 1, multiplevalue...);
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
string s;
cin >> s;
map < string , int> counts;
int ans = 0;
for(int i= 0;i<s.size();i++){
string made;
for(int j = i;j<s.size();j++){
made += s[j];
counts[made]++;
ans = max(ans , (int)counts[made] *(int) made.size());
}
}
cout << ans << endl;
cerr << "time taken : " << (float)clock() / CLOCKS_PER_SEC << " secs" << "\n";
return 0;
}
Compilation message (stderr)
palindrome.cpp: In function 'int main()':
palindrome.cpp:25:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
25 | for(int i= 0;i<s.size();i++){
| ~^~~~~~~~~
palindrome.cpp:27:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
27 | for(int j = i;j<s.size();j++){
| ~^~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |