Submission #19503956


Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
const int inf = 1<<30;
const ll INF = 1LL<<60;
#define all(x) (x).begin(),(x).end()
 
int main(){
 
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);

    string s; cin >> s;
    int n = s.size();
    int ans = 0;
    if(n%2==0){
        string t = s.substr(n/2);
        reverse(all(t));
        int f = s.find(t);
        if(f==0 || f==1) ans = f;
        else ans = n - 1;
    }else{
        string t = s.substr((n+1)/2);
        reverse(all(t));
        int f = s.find(t);
        if(f==0 || f==1 || f==2) ans = f;
        else ans = n - 1;
    }
    cout << ans << '\n';
}

Submission Info

Submission Time
Task B - Concatenated Palindrome
User sola_power
Language C++ (GCC 9.2.1)
Score 0
Code Size 687 Byte
Status WA
Exec Time 5 ms
Memory 3652 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 200
Status
AC × 4
AC × 13
WA × 5
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt
All sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt, subtask_1_1.txt, subtask_1_10.txt, subtask_1_11.txt, subtask_1_12.txt, subtask_1_13.txt, subtask_1_14.txt, subtask_1_2.txt, subtask_1_3.txt, subtask_1_4.txt, subtask_1_5.txt, subtask_1_6.txt, subtask_1_7.txt, subtask_1_8.txt, subtask_1_9.txt
Case Name Status Exec Time Memory
sample_01.txt AC 5 ms 3516 KB
sample_02.txt AC 2 ms 3616 KB
sample_03.txt AC 2 ms 3620 KB
sample_04.txt AC 3 ms 3600 KB
subtask_1_1.txt AC 2 ms 3652 KB
subtask_1_10.txt WA 3 ms 3548 KB
subtask_1_11.txt WA 2 ms 3592 KB
subtask_1_12.txt WA 2 ms 3552 KB
subtask_1_13.txt WA 2 ms 3500 KB
subtask_1_14.txt AC 5 ms 3600 KB
subtask_1_2.txt AC 2 ms 3620 KB
subtask_1_3.txt AC 2 ms 3548 KB
subtask_1_4.txt AC 2 ms 3568 KB
subtask_1_5.txt AC 2 ms 3592 KB
subtask_1_6.txt AC 3 ms 3456 KB
subtask_1_7.txt AC 2 ms 3552 KB
subtask_1_8.txt AC 2 ms 3460 KB
subtask_1_9.txt WA 2 ms 3652 KB