結果

問題 No.625 ソンタクロース
ユーザー tailstails
提出日時 2017-12-25 00:40:12
言語 Perl
(5.38.0)
結果
AC  
実行時間 184 ms / 4,000 ms
コード長 306 bytes
コンパイル時間 832 ms
コンパイル使用メモリ 5,376 KB
実行使用メモリ 5,388 KB
最終ジャッジ日時 2023-08-22 18:08:09
合計ジャッジ時間 2,581 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 6 ms
5,056 KB
testcase_01 AC 6 ms
5,356 KB
testcase_02 AC 6 ms
5,248 KB
testcase_03 AC 6 ms
5,128 KB
testcase_04 AC 6 ms
5,100 KB
testcase_05 AC 6 ms
5,168 KB
testcase_06 AC 6 ms
5,224 KB
testcase_07 AC 6 ms
5,244 KB
testcase_08 AC 6 ms
5,336 KB
testcase_09 AC 6 ms
5,092 KB
testcase_10 AC 6 ms
5,244 KB
testcase_11 AC 7 ms
5,232 KB
testcase_12 AC 6 ms
5,244 KB
testcase_13 AC 7 ms
5,320 KB
testcase_14 AC 6 ms
5,220 KB
testcase_15 AC 22 ms
5,252 KB
testcase_16 AC 13 ms
5,236 KB
testcase_17 AC 80 ms
5,244 KB
testcase_18 AC 184 ms
5,388 KB
testcase_19 AC 32 ms
5,144 KB
testcase_20 AC 34 ms
5,248 KB
testcase_21 AC 20 ms
5,200 KB
testcase_22 AC 152 ms
5,364 KB
testcase_23 AC 17 ms
5,356 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

($n,$m)=glob<>;
for$i(0..$n-1){
	@b=sort{$a-$b}@a;
	$w=($i+1)>>1;
	$c=$b[$w-1];
	$s=0;
	$v=0;
	$s+=$_,$v+=$_==$c for @b[0..$w-1];
	if($s+$w>$m){
		$a[$i]=-1;
	}else{
		$s=0;
		for(@a){
			if($_<$c||($_==$c&&$v-->0)){
				$s+=$_+=1;
			}else{
				$_=0;
			}
		}
		$a[$i]=$m-$s;
	}
}
@a=reverse@a;
print"@a"
0