Submission #1100843

#TimeUsernameProblemLanguageResultExecution timeMemory
1100843imarnPalindromes (APIO14_palindrome)C++14
0 / 100
2 ms984 KiB
#include<bits/stdc++.h> #define ll long long #define pii pair<int,int> #define pll pair<ll,ll> #define plx pair<ll,int> #define f first #define s second #define pb push_back #define all(x) x.begin(),x.end() #define vi vector<int> #define vl vector<ll> #define vvi vector<vi> using namespace std; int main(){ ios_base::sync_with_stdio(0);cin.tie(0); string s;cin>>s; ll rs=(int)s.size(); int mem=-1;ll cnt=0; for(int i=0;i<s.size();i++){ if((s[i]-'a')!=mem){ rs = max(((cnt+1)/2)*(cnt+1-(cnt+1)/2),rs); cnt=1;mem=s[i]-'a'; }else cnt++; }rs = max(((cnt+1)/2)*(cnt+1-(cnt+1)/2),rs); cout<<rs; }

Compilation message (stderr)

palindrome.cpp: In function 'int main()':
palindrome.cpp:19:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |     for(int i=0;i<s.size();i++){
      |                 ~^~~~~~~~~
#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...