# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1100843 | imarn | Palindromes (APIO14_palindrome) | C++14 | 2 ms | 984 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |