# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1100842 | 2024-10-14T19:42:06 Z | imarn | Palindromes (APIO14_palindrome) | C++14 | 3 ms | 1388 KB |
#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-(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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 1 ms | 336 KB | Output is correct |
3 | Correct | 1 ms | 336 KB | Output is correct |
4 | Correct | 1 ms | 460 KB | Output is correct |
5 | Incorrect | 1 ms | 336 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 336 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 336 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 592 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 1388 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |