結果

問題 No.343 手抜き工事のプロ
ユーザー tailstails
提出日時 2016-02-12 23:49:33
言語 Perl
(5.38.0)
結果
AC  
実行時間 136 ms / 2,000 ms
コード長 277 bytes
コンパイル時間 64 ms
コンパイル使用メモリ 5,296 KB
実行使用メモリ 23,428 KB
最終ジャッジ日時 2023-08-25 02:41:17
合計ジャッジ時間 2,890 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,408 KB
testcase_01 AC 3 ms
4,528 KB
testcase_02 AC 2 ms
4,408 KB
testcase_03 AC 3 ms
4,428 KB
testcase_04 AC 3 ms
4,424 KB
testcase_05 AC 3 ms
4,476 KB
testcase_06 AC 2 ms
4,484 KB
testcase_07 AC 2 ms
4,640 KB
testcase_08 AC 3 ms
4,584 KB
testcase_09 AC 3 ms
4,524 KB
testcase_10 AC 2 ms
4,504 KB
testcase_11 AC 2 ms
4,564 KB
testcase_12 AC 2 ms
4,580 KB
testcase_13 AC 14 ms
6,416 KB
testcase_14 AC 3 ms
4,736 KB
testcase_15 AC 3 ms
4,504 KB
testcase_16 AC 2 ms
4,544 KB
testcase_17 AC 2 ms
4,576 KB
testcase_18 AC 3 ms
4,592 KB
testcase_19 AC 2 ms
4,480 KB
testcase_20 AC 14 ms
6,416 KB
testcase_21 AC 39 ms
11,828 KB
testcase_22 AC 52 ms
13,188 KB
testcase_23 AC 60 ms
16,548 KB
testcase_24 AC 111 ms
20,192 KB
testcase_25 AC 136 ms
23,428 KB
testcase_26 AC 136 ms
23,424 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

$n=<>;
$l=<>;
for$i(2..$n){
	$x[$i]=<>;
	exit!print-1 if abs($x[$i]-$x[$i-1])>=$l;
}
$c=0;
for$i(reverse 2..$n){
	$w+=$x[$i];
	++$c unless
		($x[$i-1]-$l/2)*($n-$i+1)<$w && $w<($x[$i-1]+$l/2)*($n-$i+1)
	&&	($x[$i-0]-$l/2)*($n-$i+1)<$w && $w<($x[$i-0]+$l/2)*($n-$i+1);
}
print$c
0