답안 #1100843

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1100843 2024-10-14T19:42:51 Z imarn 회문 (APIO14_palindrome) C++14
0 / 100
2 ms 984 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+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

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++){
      |                 ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 0 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 508 KB Output is correct
5 Incorrect 0 ms 336 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 592 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 984 KB Output isn't correct
2 Halted 0 ms 0 KB -