結果

問題 No.2204 Palindrome Splitting (No Rearrangement ver.)
ユーザー 鴨志田卓鴨志田卓
提出日時 2023-07-21 01:11:02
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 469 bytes
コンパイル時間 2,451 ms
コンパイル使用メモリ 201,496 KB
実行使用メモリ 8,696 KB
最終ジャッジ日時 2023-10-21 03:04:30
合計ジャッジ時間 7,375 ms
ジャッジサーバーID
(参考情報)
judge15 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
8,696 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 16 ms
4,348 KB
testcase_04 AC 5 ms
4,348 KB
testcase_05 AC 5 ms
4,348 KB
testcase_06 AC 28 ms
4,348 KB
testcase_07 AC 25 ms
4,348 KB
testcase_08 AC 25 ms
4,348 KB
testcase_09 AC 79 ms
4,348 KB
testcase_10 AC 48 ms
4,348 KB
testcase_11 AC 22 ms
4,348 KB
testcase_12 AC 30 ms
4,348 KB
testcase_13 AC 27 ms
4,348 KB
testcase_14 AC 44 ms
4,348 KB
testcase_15 AC 61 ms
4,348 KB
testcase_16 AC 11 ms
4,348 KB
testcase_17 AC 20 ms
4,348 KB
testcase_18 AC 29 ms
4,348 KB
testcase_19 AC 55 ms
4,348 KB
testcase_20 AC 38 ms
4,348 KB
testcase_21 AC 28 ms
4,348 KB
testcase_22 AC 32 ms
4,348 KB
testcase_23 AC 39 ms
4,348 KB
testcase_24 AC 92 ms
4,348 KB
testcase_25 AC 55 ms
4,348 KB
testcase_26 AC 26 ms
4,348 KB
testcase_27 AC 56 ms
4,348 KB
testcase_28 AC 48 ms
4,348 KB
testcase_29 AC 27 ms
4,348 KB
testcase_30 AC 2 ms
4,348 KB
testcase_31 AC 2 ms
4,348 KB
testcase_32 TLE -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

const int N = 5050;

char s[N];
int n;

int ok[N][N], dp[N];

bool p(int l, int r) {
	while(l < r) {
		if(s[l] != s[r]) return false;
		l ++;
		r --;
	}
	return true;
}

int main() {
    cin >> (s + 1);
    n = strlen(s + 1);
    dp[0] = N;
    for(int i = 1; i <= n; i ++) {
        for(int j = 1; j <= i; j ++) {
            if(p(j, i)) dp[i] = max(dp[i], min(dp[j - 1], i - j + 1));
        }
    }
    cout << dp[n];
}
0