Submission #899849

#TimeUsernameProblemLanguageResultExecution timeMemory
899849pccPalinilap (COI16_palinilap)C++14
17 / 100
1052 ms716 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define pll pair<ll,ll> #define pii pair<int,int> #define fs first #define sc second #define tlll tuple<ll,ll,ll> int ans = 0; inline bool isp(string s){ for(int i= 0;i<s.size();i++){ if(s[i] != s.end()[-i-1])return false; } return true; } inline int calc(string &s){ int re = 0; for(int len = 1;len<=s.size();len++){ for(int i = 0;i+len<=s.size();i++){ if(isp(s.substr(i,len)))re++; } } return re; } int main(){ ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); string s; cin>>s; int n = s.size(); for(int i = 0;i<n;i++){ string t = s; for(char c = 'a';c<='z';c++){ t[i] = c; ans = max(ans,calc(t)); } } cout<<ans; }

Compilation message (stderr)

palinilap.cpp: In function 'bool isp(std::string)':
palinilap.cpp:15:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |  for(int i= 0;i<s.size();i++){
      |               ~^~~~~~~~~
palinilap.cpp: In function 'int calc(std::string&)':
palinilap.cpp:23:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |  for(int len = 1;len<=s.size();len++){
      |                  ~~~^~~~~~~~~~
palinilap.cpp:24:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |   for(int i = 0;i+len<=s.size();i++){
      |                 ~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...