結果

問題 No.1120 Strange Teacher
ユーザー tailstails
提出日時 2020-07-22 21:57:18
言語 Perl
(5.38.2)
結果
WA  
実行時間 -
コード長 265 bytes
コンパイル時間 738 ms
コンパイル使用メモリ 5,384 KB
実行使用メモリ 39,972 KB
最終ジャッジ日時 2023-09-04 18:32:58
合計ジャッジ時間 9,556 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 6 ms
5,124 KB
testcase_10 AC 506 ms
38,608 KB
testcase_11 AC 477 ms
38,872 KB
testcase_12 AC 459 ms
38,764 KB
testcase_13 AC 457 ms
39,516 KB
testcase_14 AC 453 ms
39,536 KB
testcase_15 AC 458 ms
39,552 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 6 ms
5,164 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 6 ms
5,380 KB
testcase_26 AC 6 ms
5,208 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 6 ms
5,088 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Name "main::u" used only once: possible typo at Main.pl line 15.
Main.pl syntax OK

ソースコード

diff #

sub muri { print -1; exit; }

$n=<>;
@a=glob<>;
@b=glob<>;
for(0..$n-1){
	$s-=$b[$_]-=$a[$_];
}

$n==2 ? $s==0 : $s%($n-2)==0 or muri;

$n==2 or $s/=$n-2;
for(0..$n-1){
	$b[$_]+$s&1 and muri;
	$t+=$u=($b[$_]+$s)/2;
}

print "s=$s t=$t\n";
$s==$t or muri;
print $s;
0