結果

問題 No.1909 Detect from Substrings
ユーザー tailstails
提出日時 2022-04-22 21:22:46
言語 Perl
(5.38.2)
結果
AC  
実行時間 426 ms / 2,000 ms
コード長 471 bytes
コンパイル時間 636 ms
コンパイル使用メモリ 5,360 KB
実行使用メモリ 8,744 KB
最終ジャッジ日時 2023-09-06 07:38:49
合計ジャッジ時間 11,269 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 6 ms
5,300 KB
testcase_01 AC 6 ms
5,240 KB
testcase_02 AC 6 ms
5,388 KB
testcase_03 AC 7 ms
5,120 KB
testcase_04 AC 13 ms
5,248 KB
testcase_05 AC 57 ms
5,784 KB
testcase_06 AC 66 ms
6,328 KB
testcase_07 AC 70 ms
6,484 KB
testcase_08 AC 232 ms
8,632 KB
testcase_09 AC 150 ms
8,112 KB
testcase_10 AC 121 ms
7,140 KB
testcase_11 AC 91 ms
6,928 KB
testcase_12 AC 127 ms
6,556 KB
testcase_13 AC 270 ms
8,544 KB
testcase_14 AC 333 ms
8,016 KB
testcase_15 AC 230 ms
8,620 KB
testcase_16 AC 198 ms
6,468 KB
testcase_17 AC 177 ms
6,248 KB
testcase_18 AC 175 ms
6,236 KB
testcase_19 AC 177 ms
6,228 KB
testcase_20 AC 175 ms
6,432 KB
testcase_21 AC 254 ms
8,004 KB
testcase_22 AC 339 ms
8,724 KB
testcase_23 AC 194 ms
6,788 KB
testcase_24 AC 201 ms
6,860 KB
testcase_25 AC 188 ms
6,612 KB
testcase_26 AC 316 ms
8,744 KB
testcase_27 AC 272 ms
8,000 KB
testcase_28 AC 256 ms
7,916 KB
testcase_29 AC 426 ms
8,188 KB
testcase_30 AC 416 ms
7,980 KB
testcase_31 AC 419 ms
8,076 KB
testcase_32 AC 417 ms
7,932 KB
testcase_33 AC 380 ms
8,140 KB
testcase_34 AC 417 ms
7,920 KB
testcase_35 AC 404 ms
8,056 KB
testcase_36 AC 419 ms
8,060 KB
testcase_37 AC 404 ms
7,988 KB
testcase_38 AC 417 ms
8,064 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Name "main::n" used only once: possible typo at Main.pl line 18.
Main.pl syntax OK

ソースコード

diff #

sub check{
	for$s(@s){
		$k=0;
		while(substr($t,$k,1) eq substr($s,$k,1)){
			++$k;
		}
		while($k<$m && substr($t,$k+1,1) eq substr($s,$k,1)){
			++$k;
		}
		if($k!=$m){
			return 0;
		}
	}
	return 1;
}


($n,$m)=glob<>;
@s=<>;
while(substr($s[0],$i,1) eq substr($s[1],$i,1)){
	++$i;
}
$j=$m-1;
while(substr($s[0],$j,1) eq substr($s[1],$j,1)){
	--$j;
}
$r+=check($t=substr($s[0],0,$j+1).substr($s[1],$j));
$r+=check($t=substr($s[1],0,$j+1).substr($s[0],$j));
print $r;
0