제출 #980036

#제출 시각아이디문제언어결과실행 시간메모리
980036ElayV13회문 (APIO14_palindrome)C++17
0 / 100
533 ms131072 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long const int m_INF = -1e9+7; bool palindrom(string s){ reverse(s.begin(),s.end()); string z = s ; reverse(s.begin(),s.end()); if(z == s){ return true; } else{ return false; } } ll find_say_string(string s , string q) { ll say = 0 ; for(ll i = 0;i < s.size();i++){ string z = ""; for(ll j = i;j < i + q.size();j++) { z += s[j]; } if(z == q) { say++; } } return say ; } void find_max_palindrom_on_string(string s) { ll l = 0 , r = s.size()-1 ; vector < string > palindroms ; vector < char > q ; if(palindrom(s)){ palindroms.push_back(s); } for(ll i = 0;i < s.size();i++){ q.push_back(s[i]); } while(r > 0) { string z = s.substr(l,r); if(palindrom(z) && z.size() != 1) { palindroms.push_back(z); } l++; if(l == r) { l = 0 ; r--; } } sort(palindroms.begin(),palindroms.end()); for(ll i = 0;i < palindroms.size();i++){ if(palindroms[i] == palindroms[i+1]){ palindroms.erase(palindroms.begin() + i); } } /////////////////////////////////////////////////////////////////////////////// int maks = m_INF ; for(ll i = 0;i < palindroms.size();i++) { string t = palindroms[i]; maks = max(maks,int(t.size())*(int((find_say_string(s,t))))); } for(ll i = 0;i < q.size();i++) { int say = 0 ; char c = q[i] ; for(ll j = 0;j < s.size();j++) { if(s[j] == c){ say++; } } maks = max(maks,say); } cout << maks << endl ; } signed main() { string s ; cin >> s ; find_max_palindrom_on_string(s); }

컴파일 시 표준 에러 (stderr) 메시지

palindrome.cpp: In function 'long long int find_say_string(std::string, std::string)':
palindrome.cpp:26:20: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |     for(ll i = 0;i < s.size();i++){
      |                  ~~^~~~~~~~~~
palindrome.cpp:29:24: warning: comparison of integer expressions of different signedness: 'long long int' and 'long long unsigned int' [-Wsign-compare]
   29 |         for(ll j = i;j < i + q.size();j++)
      |                      ~~^~~~~~~~~~~~~~
palindrome.cpp: In function 'void find_max_palindrom_on_string(std::string)':
palindrome.cpp:55:20: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   55 |     for(ll i = 0;i < s.size();i++){
      |                  ~~^~~~~~~~~~
palindrome.cpp:80:20: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   80 |     for(ll i = 0;i < palindroms.size();i++){
      |                  ~~^~~~~~~~~~~~~~~~~~~
palindrome.cpp:90:20: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   90 |     for(ll i = 0;i < palindroms.size();i++)
      |                  ~~^~~~~~~~~~~~~~~~~~~
palindrome.cpp:97:20: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   97 |     for(ll i = 0;i < q.size();i++)
      |                  ~~^~~~~~~~~~
palindrome.cpp:103:24: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  103 |         for(ll j = 0;j < s.size();j++)
      |                      ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...