結果
| 問題 | No.1120 Strange Teacher |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-09-02 08:12:33 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 91 ms / 1,000 ms |
| コード長 | 361 bytes |
| 記録 | |
| コンパイル時間 | 231 ms |
| コンパイル使用メモリ | 85,632 KB |
| 実行使用メモリ | 104,192 KB |
| 最終ジャッジ日時 | 2026-05-23 07:04:22 |
| 合計ジャッジ時間 | 5,655 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 |
ソースコード
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
if N==2:
if sum(A)==sum(B):
print(abs(A[0]-B[0]))
else:
print(-1)
else:
a=sum(A)
b=sum(B)
if (a-b)%(N-2)==0:
x=(a-b)//(N-2)
for i in range(N):
d=x-A[i]+B[i]
if d<0 or d%2==1:
print(-1)
exit()
print(x)
else:
print(-1)