結果

問題 No.489 株に挑戦
ユーザー tailstails
提出日時 2017-02-24 23:45:53
言語 Perl
(5.38.2)
結果
WA  
実行時間 -
コード長 569 bytes
コンパイル時間 772 ms
コンパイル使用メモリ 5,344 KB
実行使用メモリ 32,692 KB
最終ジャッジ日時 2023-08-31 00:16:19
合計ジャッジ時間 17,650 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 622 ms
27,956 KB
testcase_01 AC 549 ms
23,152 KB
testcase_02 AC 61 ms
14,600 KB
testcase_03 AC 61 ms
14,800 KB
testcase_04 AC 61 ms
14,552 KB
testcase_05 AC 61 ms
14,588 KB
testcase_06 AC 62 ms
14,468 KB
testcase_07 AC 61 ms
14,736 KB
testcase_08 AC 61 ms
14,448 KB
testcase_09 AC 63 ms
14,588 KB
testcase_10 AC 62 ms
14,732 KB
testcase_11 AC 62 ms
14,740 KB
testcase_12 AC 62 ms
14,572 KB
testcase_13 AC 62 ms
14,716 KB
testcase_14 AC 62 ms
14,828 KB
testcase_15 AC 85 ms
15,476 KB
testcase_16 WA -
testcase_17 AC 99 ms
17,120 KB
testcase_18 AC 521 ms
23,236 KB
testcase_19 AC 453 ms
21,428 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 116 ms
16,056 KB
testcase_23 AC 373 ms
24,048 KB
testcase_24 TLE -
testcase_25 AC 62 ms
14,680 KB
testcase_26 TLE -
testcase_27 AC 870 ms
32,480 KB
testcase_28 AC 62 ms
14,536 KB
testcase_29 AC 62 ms
14,592 KB
testcase_30 TLE -
testcase_31 TLE -
testcase_32 AC 547 ms
24,124 KB
testcase_33 TLE -
testcase_34 AC 920 ms
29,428 KB
testcase_35 AC 385 ms
20,532 KB
testcase_36 WA -
testcase_37 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Name "main::z" used only once: possible typo at Main.pl line 31.
Main.pl syntax OK

ソースコード

diff #

($n,$d,$k)=glob<>;
@x=<>;

for$i(0..0x1ffff){
	$x0=$x[$i<<1|0];
	$x1=$x[$i<<1|1];
	$x[$i|0x20000]=$x0<$x1?$x0:$x1;
}

sub f{
	my($i,$j)=@_;
	my$b=1e9;
	while(1){
		if($i&1){
			$b=$x[$i] if $b>$x[$i];
			++$i;
		}
		if(!($j&1)){
			$b=$x[$j] if $b>$x[$j];
			--$j;
		}
		last if $i>=$j;
		$i=0x20000|$i>>1;
		$j=0x20000|$j>>1;
	}
	$b;
}

$b=0;
for$i(0..$n-1){
	$z=f($j=$i-$d<0?0:$i-$d,$i);
	$c=$x[$i]- f($j=$i-$d<0?0:$i-$d,$i);
	$b=$c,$j1=$i if $b<$c;
}
if($b){
	for($j1-$d..$j1){
		$j0=$_,last if $b==$x[$j1]-$x[$_]
	}
	print $b*$k,$/,$j0,$",$j1;
}else{
	print 0;
}
	
0