結果

問題 No.326 あみだますたー
ユーザー tailstails
提出日時 2015-12-19 00:19:58
言語 Perl
(5.38.2)
結果
WA  
実行時間 -
コード長 308 bytes
コンパイル時間 383 ms
コンパイル使用メモリ 5,268 KB
実行使用メモリ 4,940 KB
最終ジャッジ日時 2023-10-14 14:09:03
合計ジャッジ時間 4,617 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,796 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 2 ms
4,592 KB
testcase_06 AC 7 ms
4,648 KB
testcase_07 AC 3 ms
4,576 KB
testcase_08 AC 32 ms
4,736 KB
testcase_09 AC 31 ms
4,748 KB
testcase_10 AC 35 ms
4,776 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

$n=<>;
$k=<>;
@b=0..$n;
$x=<>,$t=$b[$x],$b[$x]=$b[$x+1],$b[$x+1]=$t for 1..$k;
@a=(0,<>=~/\d+/g);

while(1){
	$i=1;
	while($i<$n&&$a[$i]==$b[$i]){
		++$i;
	}
	last if $i==$n;
	$j=$i;
	while($a[$i]!=$b[$j]){
		++$j;
	}
	push@y,$j;
	$t=$b[$j],$b[$j]=$b[$j-1],$b[$j-1]=$t;
}
print@y.$/;
print$_-1,$",$_,$/for@y;
0