結果

問題 No.1120 Strange Teacher
ユーザー tailstails
提出日時 2020-07-22 21:59:03
言語 Perl
(5.40.0)
結果
WA  
実行時間 -
コード長 252 bytes
コンパイル時間 141 ms
コンパイル使用メモリ 7,076 KB
実行使用メモリ 29,824 KB
最終ジャッジ日時 2024-06-22 16:28:36
合計ジャッジ時間 3,184 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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=<>=~/\S+/g;
@b=<>=~/\S+/g;
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