結果
| 問題 | No.1120 Strange Teacher |
| コンテスト | |
| ユーザー |
AEn
|
| 提出日時 | 2022-05-21 12:16:30 |
| 言語 | PyPy3 (7.3.23) |
| 結果 |
AC
|
| 実行時間 | 89 ms / 1,000 ms |
| + 703µs | |
| コード長 | 520 bytes |
| 記録 | |
| コンパイル時間 | 231 ms |
| コンパイル使用メモリ | 95,828 KB |
| 実行使用メモリ | 118,656 KB |
| 最終ジャッジ日時 | 2026-08-31 18:29:18 |
| 合計ジャッジ時間 | 5,420 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 |
ソースコード
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
m = []
for i in range(N):
m.append(A[i]-B[i])
if N == 2:
if sum(A) != sum(B):
print(-1)
else:
print(abs(A[0]-B[0]))
exit()
sm = sum(m)
if sm % (N-2) != 0:
print(-1)
exit()
res = sm//(N-2)
for i in range(N):
m[i] -= res
cnt = 0
for i in range(N):
if m[i]%2!=0 or m[i]>0:
print(-1)
exit()
cnt += -m[i]//2
if cnt > res:
print(-1)
exit()
print(res)
AEn