답안 #173641

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
173641 2020-01-04T18:55:15 Z Nucleist 회문 (APIO14_palindrome) C++14
0 / 100
1000 ms 1044 KB
#include <bits/stdc++.h> 
using namespace std; 
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define flash ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define debug(x) cerr << " - " << #x << ": " << x << endl;
#define debugs(x, y) cerr << " - " << #x << ": " << x << " " << #y << ": " << y << endl;
#define all(x) (x).begin(),(x).end()
#define sz(x) (ll)x.size()
#define ll long long
#define INF 1000000000
#define MOD 1000000007
#define pb push_back
#define ve vector<ll>
#define dos pair<ll,ll>
#define vedos vector<dos>
#define rand mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
struct greateri
{
    template<class T>
    bool operator()(T const &a, T const &b) const { return a > b; }
};
int main()
{
  //flash;
  string a;
  cin>>a;
  ll ans=0;
  for (ll i = 0; i < a.size(); ++i)
  {
    for (ll j = i; j < a.size(); ++j)
    {
      string dol;
      ll ka=0;
      for (ll k = i; k <= j; ++k)
      {
        dol+=a[k];
      }
      string hey=dol;
      reverse(hey.begin(),hey.end());
      if(hey==dol)
      {for (ll k = 0; k < a.size()-j+i; ++k)
      {
        string nol = a.substr(k,k+(j-i+1));
        if(nol==dol)ka++;
      }
      ans=max(ans,ka*(j-i+1));}
    }
  }
  cout<<ans;
  return 0;
}
//code the AC sol !
// BS/queue/map

Compilation message

palindrome.cpp:4:0: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
 #pragma GCC optimization ("O3")
 
palindrome.cpp:5:0: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
 #pragma GCC optimization ("unroll-loops")
 
palindrome.cpp: In function 'int main()':
palindrome.cpp:30:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (ll i = 0; i < a.size(); ++i)
                  ~~^~~~~~~~~~
palindrome.cpp:32:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (ll j = i; j < a.size(); ++j)
                    ~~^~~~~~~~~~
palindrome.cpp:43:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       {for (ll k = 0; k < a.size()-j+i; ++k)
                       ~~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Incorrect 2 ms 256 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1080 ms 256 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1082 ms 376 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1090 ms 504 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1076 ms 1044 KB Time limit exceeded
2 Halted 0 ms 0 KB -