結果

問題 No.967 引き算をして門松列(その2)
ユーザー tailstails
提出日時 2020-12-17 17:55:04
言語 Perl
(5.38.2)
結果
AC  
実行時間 69 ms / 2,000 ms
コード長 251 bytes
コンパイル時間 170 ms
コンパイル使用メモリ 5,504 KB
実行使用メモリ 7,124 KB
最終ジャッジ日時 2023-10-21 07:00:48
合計ジャッジ時間 1,558 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
5,524 KB
testcase_01 AC 3 ms
5,528 KB
testcase_02 AC 3 ms
5,524 KB
testcase_03 AC 27 ms
6,168 KB
testcase_04 AC 28 ms
6,156 KB
testcase_05 AC 27 ms
6,160 KB
testcase_06 AC 29 ms
6,160 KB
testcase_07 AC 29 ms
6,160 KB
testcase_08 AC 46 ms
6,540 KB
testcase_09 AC 65 ms
7,124 KB
testcase_10 AC 68 ms
7,052 KB
testcase_11 AC 69 ms
7,124 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Name "main::y" used only once: possible typo at Main.pl line 2.
Main.pl syntax OK

ソースコード

diff #

sub f{
	($b,$y,$a,$x,$c,$z,$t)=@a[map{$_,$_+3}@_];
	$a<$b or $t+=$x*($a-$b+1),$a=$b-1;
	$c<$a or $t+=$z*($c-$a+1),$c=$a-1;
	$c>0?$t+0:();
}

<>;
for(<>){
	@a=split;
	print+(sort{$a<=>$b}
		f(1,0,2),
		f(1,2,0),
		f(0,2,1),
		f(2,0,1),
	)[0]//-1,$/;
}
0