結果
| 問題 |
No.1120 Strange Teacher
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-07-26 16:31:32 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 398 bytes |
| コンパイル時間 | 217 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 25,256 KB |
| 最終ジャッジ日時 | 2024-06-28 17:17:58 |
| 合計ジャッジ時間 | 4,254 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 26 WA * 1 |
ソースコード
N = int(input())
A = tuple(map(int, input().split()))
B = tuple(map(int, input().split()))
def is_impossible(b):
if b:
print(-1)
exit()
if N == 2:
print(abs(A[0] - B[0]) if sum(A) == sum(B) else -1)
exit()
is_impossible((sum(A) - sum(B)) % (N - 2))
x = (sum(A) - sum(B)) // (N - 2)
is_impossible(x < 0)
is_impossible(any(B[i] < A[i] - x for i in range(N)))
print(x)