Submission #480866

# Submission time Handle Problem Language Result Execution time Memory
480866 2021-10-18T13:34:38 Z callmepandey Palindromes (APIO14_palindrome) C++17
0 / 100
2 ms 332 KB
#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()
{
  #ifndef ONLINE_JUDGE
      freopen("input.txt", "r", stdin);
  #endif
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string s;
  cin >> s;
  map < string , ll> counts;
  ll 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 , (ll)counts[made] *(ll) made.size());
    }
  }
  cout << ans << endl;
  //cerr << "time taken : " << (float)clock() / CLOCKS_PER_SEC << " secs" << "\n";
  return 0;
}  

Compilation message

palindrome.cpp: In function 'int main()':
palindrome.cpp:28:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |   for(int i= 0;i<s.size();i++){
      |                ~^~~~~~~~~
palindrome.cpp:30:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |     for(int j = i;j<s.size();j++){
      |                   ~^~~~~~~~~
palindrome.cpp:20:14: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |       freopen("input.txt", "r", stdin);
      |       ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -