結果

問題 No.451 575
ユーザー tailstails
提出日時 2016-12-02 00:32:12
言語 Perl
(5.38.0)
結果
AC  
実行時間 645 ms / 2,000 ms
コード長 373 bytes
コンパイル時間 255 ms
コンパイル使用メモリ 5,372 KB
実行使用メモリ 30,708 KB
最終ジャッジ日時 2023-08-22 12:36:10
合計ジャッジ時間 6,677 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,560 KB
testcase_01 AC 3 ms
4,568 KB
testcase_02 AC 3 ms
4,588 KB
testcase_03 AC 2 ms
4,564 KB
testcase_04 AC 3 ms
4,496 KB
testcase_05 AC 32 ms
5,908 KB
testcase_06 AC 109 ms
8,712 KB
testcase_07 AC 645 ms
30,532 KB
testcase_08 AC 2 ms
4,416 KB
testcase_09 AC 4 ms
4,808 KB
testcase_10 AC 44 ms
11,060 KB
testcase_11 AC 133 ms
24,496 KB
testcase_12 AC 175 ms
30,704 KB
testcase_13 AC 127 ms
30,708 KB
testcase_14 AC 3 ms
4,456 KB
testcase_15 AC 21 ms
5,320 KB
testcase_16 AC 86 ms
8,056 KB
testcase_17 AC 532 ms
26,548 KB
testcase_18 AC 536 ms
26,452 KB
testcase_19 AC 350 ms
18,972 KB
testcase_20 AC 9 ms
5,440 KB
testcase_21 AC 4 ms
4,848 KB
testcase_22 AC 3 ms
4,556 KB
testcase_23 AC 174 ms
30,692 KB
testcase_24 AC 104 ms
19,852 KB
testcase_25 AC 3 ms
4,588 KB
testcase_26 AC 2 ms
4,584 KB
testcase_27 AC 5 ms
4,632 KB
testcase_28 AC 8 ms
4,664 KB
testcase_29 AC 55 ms
6,772 KB
testcase_30 AC 545 ms
26,540 KB
testcase_31 AC 2 ms
4,416 KB
testcase_32 AC 214 ms
13,228 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

$e=1000000000000000000;
($n,@b)=<>;
@a=1;
for(0..9){
	if($a[0]<1){
		$a[0]=1;
	}
	if($a[0]>$e){
		$a[0]=$e;
	}
	$m=$e;$o=0;
	for(0..$#b){
		$v=$a[$_+1]=($b[$_]-$a[$_])*(-1)**$_;
		if($_%4==1||$_%4==2){
			$v=$e+1-$v;
		}
		$m=$v if $m>$v;
		$o=$v if $o<$v;
	}
	if($m<1){
		$a[0]+=1-$m;
	}elsif($o>$e){
		$a[0]-=$o-$e;
	}else{
		print join$/,$n+1,@a;
		exit;
	}
}
print -1;
0