Submission #19504275


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();
    for(int i=0;i<n;i++){
        int cnt = 0;
        if(i!=0) s += '#';
        int m = s.size();
        for(int j=0;j<=m/2-1;j++){
            if(s[j]==s[m-j-1] || s[m-j-1]=='#') cnt++;
        }
        if(cnt==m/2){
            cout << i << '\n';
            exit(0);
        }
    }
}

Submission Info

Submission Time
Task B - Concatenated Palindrome
User sola_power
Language C++ (GCC 9.2.1)
Score 200
Code Size 595 Byte
Status AC
Exec Time 8 ms
Memory 3612 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 4
AC × 18
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 8 ms 3588 KB
sample_02.txt AC 2 ms 3588 KB
sample_03.txt AC 2 ms 3472 KB
sample_04.txt AC 2 ms 3584 KB
subtask_1_1.txt AC 2 ms 3612 KB
subtask_1_10.txt AC 2 ms 3544 KB
subtask_1_11.txt AC 2 ms 3532 KB
subtask_1_12.txt AC 2 ms 3556 KB
subtask_1_13.txt AC 2 ms 3424 KB
subtask_1_14.txt AC 2 ms 3552 KB
subtask_1_2.txt AC 2 ms 3544 KB
subtask_1_3.txt AC 2 ms 3524 KB
subtask_1_4.txt AC 2 ms 3464 KB
subtask_1_5.txt AC 2 ms 3484 KB
subtask_1_6.txt AC 1 ms 3588 KB
subtask_1_7.txt AC 2 ms 3588 KB
subtask_1_8.txt AC 2 ms 3588 KB
subtask_1_9.txt AC 2 ms 3468 KB