結果

問題 No.366 ロボットソート
ユーザー %20%20
提出日時 2018-08-01 01:31:22
言語 Perl
(5.38.2)
結果
AC  
実行時間 265 ms / 2,000 ms
コード長 198 bytes
コンパイル時間 237 ms
コンパイル使用メモリ 6,120 KB
実行使用メモリ 6,936 KB
最終ジャッジ日時 2023-10-19 20:37:01
合計ジャッジ時間 1,785 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 8 ms
6,208 KB
testcase_01 AC 8 ms
6,216 KB
testcase_02 AC 8 ms
6,208 KB
testcase_03 AC 8 ms
6,216 KB
testcase_04 AC 8 ms
6,212 KB
testcase_05 AC 8 ms
6,208 KB
testcase_06 AC 8 ms
6,212 KB
testcase_07 AC 8 ms
6,208 KB
testcase_08 AC 8 ms
6,208 KB
testcase_09 AC 8 ms
6,216 KB
testcase_10 AC 8 ms
6,220 KB
testcase_11 AC 12 ms
6,416 KB
testcase_12 AC 16 ms
6,436 KB
testcase_13 AC 9 ms
6,492 KB
testcase_14 AC 11 ms
6,592 KB
testcase_15 AC 9 ms
6,388 KB
testcase_16 AC 10 ms
6,472 KB
testcase_17 AC 13 ms
6,580 KB
testcase_18 AC 24 ms
6,892 KB
testcase_19 AC 20 ms
6,584 KB
testcase_20 AC 8 ms
6,212 KB
testcase_21 AC 61 ms
6,936 KB
testcase_22 AC 265 ms
6,936 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Smartmatch is deprecated at Main.pl line 13.
Main.pl syntax OK

ソースコード

diff #

($N,$K)=glob<>;
@a=glob<>;
for(0..$K-1){
	for($i=$_;$i<$N;$i+=$K){
		for($j=$i;$j<$N;$j+=$K){
			if($a[$i]>$a[$j]){
				++$%;
				@a[$i,$j]=@a[$j,$i]
			}
		}
	}
}
print@a~~@{[sort{$a-$b}@a]}?$%:-1
0