結果

問題 No.1120 Strange Teacher
ユーザー tails
提出日時 2020-07-22 21:58:13
言語 Perl
(5.40.0)
結果
WA  
実行時間 -
コード長 244 bytes
コンパイル時間 359 ms
コンパイル使用メモリ 7,324 KB
実行使用メモリ 41,280 KB
最終ジャッジ日時 2024-06-22 16:24:59
合計ジャッジ時間 9,119 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23 WA * 4
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;
}

$s==$t or muri;
print $s;
0