Submission #17484364


Source Code Expand

Copy
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MOD2 = 998244353;

bool isPar(string t){
    int m = t.size();
    bool flag = 1;
    rep(i, m/2) flag &= (t[i] == t[m-i-1]);
    return flag;
}

int main(){
    string s;
    cin >> s;

    int res = 0;
    int n = s.size();
    rep(i, s.size()){
        string t = s.substr(n-i-1,i+1);
        if (isPar(t)) res = n - i - 1;
    }

    cout << res << endl;
    return 0;
}

Submission Info

Submission Time
Task B - Concatenated Palindrome
User bustle0309
Language C++ (GCC 9.2.1)
Score 200
Code Size 703 Byte
Status
Exec Time 6 ms
Memory 3620 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:2:37: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
    2 | #define rep(i, n) for (int i = 0; i < n; i++)
......
   26 |     rep(i, s.size()){
      |         ~~~~~~~~~~~                  
./Main.cpp:26:5: note: in expansion of macro ‘rep’
   26 |     rep(i, s.size()){
      |     ^~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
× 4
× 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 6 ms 3488 KB
sample_02.txt 2 ms 3588 KB
sample_03.txt 2 ms 3528 KB
sample_04.txt 2 ms 3476 KB
subtask_1_1.txt 2 ms 3580 KB
subtask_1_10.txt 2 ms 3468 KB
subtask_1_11.txt 2 ms 3420 KB
subtask_1_12.txt 2 ms 3548 KB
subtask_1_13.txt 3 ms 3488 KB
subtask_1_14.txt 2 ms 3620 KB
subtask_1_2.txt 3 ms 3540 KB
subtask_1_3.txt 2 ms 3544 KB
subtask_1_4.txt 2 ms 3412 KB
subtask_1_5.txt 2 ms 3592 KB
subtask_1_6.txt 2 ms 3592 KB
subtask_1_7.txt 2 ms 3492 KB
subtask_1_8.txt 2 ms 3492 KB
subtask_1_9.txt 2 ms 3620 KB