結果

問題 No.2204 Palindrome Splitting (No Rearrangement ver.)
ユーザー tailstails
提出日時 2023-02-03 22:33:17
言語 cLay
(20240104-1)
結果
AC  
実行時間 229 ms / 2,000 ms
コード長 416 bytes
コンパイル時間 2,789 ms
コンパイル使用メモリ 163,636 KB
実行使用メモリ 27,996 KB
最終ジャッジ日時 2023-09-15 18:40:02
合計ジャッジ時間 9,500 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,428 KB
testcase_01 AC 2 ms
5,432 KB
testcase_02 AC 2 ms
5,488 KB
testcase_03 AC 129 ms
23,572 KB
testcase_04 AC 35 ms
13,896 KB
testcase_05 AC 22 ms
11,540 KB
testcase_06 AC 226 ms
27,840 KB
testcase_07 AC 204 ms
27,728 KB
testcase_08 AC 184 ms
27,160 KB
testcase_09 AC 194 ms
27,588 KB
testcase_10 AC 228 ms
27,908 KB
testcase_11 AC 184 ms
27,032 KB
testcase_12 AC 227 ms
27,972 KB
testcase_13 AC 228 ms
27,980 KB
testcase_14 AC 229 ms
27,920 KB
testcase_15 AC 210 ms
27,776 KB
testcase_16 AC 86 ms
20,220 KB
testcase_17 AC 98 ms
22,320 KB
testcase_18 AC 204 ms
27,836 KB
testcase_19 AC 204 ms
27,856 KB
testcase_20 AC 202 ms
27,852 KB
testcase_21 AC 201 ms
27,968 KB
testcase_22 AC 204 ms
27,832 KB
testcase_23 AC 203 ms
27,996 KB
testcase_24 AC 202 ms
27,980 KB
testcase_25 AC 203 ms
27,832 KB
testcase_26 AC 202 ms
27,980 KB
testcase_27 AC 127 ms
24,860 KB
testcase_28 AC 207 ms
27,964 KB
testcase_29 AC 202 ms
27,848 KB
testcase_30 AC 1 ms
5,392 KB
testcase_31 AC 2 ms
5,496 KB
testcase_32 AC 179 ms
26,216 KB
testcase_33 AC 204 ms
27,860 KB
testcase_34 AC 2 ms
5,680 KB
testcase_35 AC 179 ms
26,220 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

char s[5001];
int l;

char memo[5000][5001];

bool ispali(int a,int b){
	if(memo[a][b]){
		return memo[a][b]>0;
	}
	{
		bool z;
		if(a+1==b){
			z=true;
		}else if(a+2==b){
			z=s[a]==s[b-1];
		}else{
			z=ispali(a+1,b-1)&&s[a]==s[b-1];
		}
		memo[a][b]=z?1:-1;
		return z;
	}
}

int d[5001];

{
	rd(s@l);
	d[0]=l;
	rep(i,l){
		rep(j,i+1,l+1){
			if(ispali(i,j)){
				d[j]>?=min(d[i],j-i);
			}
		}
	}
	wt(d[l]);
}
0