結果

問題 No.1120 Strange Teacher
ユーザー wattaiheiwattaihei
提出日時 2020-07-22 21:37:03
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 384 bytes
コンパイル時間 784 ms
コンパイル使用メモリ 10,952 KB
実行使用メモリ 24,260 KB
最終ジャッジ日時 2023-09-04 16:10:32
合計ジャッジ時間 3,345 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,980 KB
testcase_01 AC 16 ms
7,872 KB
testcase_02 AC 16 ms
8,284 KB
testcase_03 AC 23 ms
9,788 KB
testcase_04 AC 92 ms
23,448 KB
testcase_05 AC 91 ms
23,444 KB
testcase_06 AC 90 ms
23,452 KB
testcase_07 AC 92 ms
23,516 KB
testcase_08 AC 91 ms
23,468 KB
testcase_09 AC 15 ms
7,816 KB
testcase_10 AC 74 ms
24,260 KB
testcase_11 AC 74 ms
24,216 KB
testcase_12 AC 74 ms
24,144 KB
testcase_13 AC 74 ms
23,300 KB
testcase_14 AC 73 ms
23,448 KB
testcase_15 AC 75 ms
23,452 KB
testcase_16 AC 74 ms
23,460 KB
testcase_17 AC 74 ms
23,464 KB
testcase_18 AC 16 ms
7,868 KB
testcase_19 AC 91 ms
23,020 KB
testcase_20 AC 15 ms
7,868 KB
testcase_21 AC 15 ms
7,972 KB
testcase_22 AC 16 ms
7,824 KB
testcase_23 AC 16 ms
8,008 KB
testcase_24 AC 83 ms
19,804 KB
testcase_25 AC 16 ms
7,968 KB
testcase_26 WA -
testcase_27 AC 15 ms
7,980 KB
testcase_28 AC 15 ms
7,820 KB
testcase_29 AC 15 ms
7,872 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

Sa = sum(A)
Sb = sum(B)

ans = -1
if N == 2:
    if Sa == Sb:
        ans = abs(A[0]-B[0])
elif Sa >= Sb and (Sa-Sb)%(N-2) == 0:
    ans = (Sa-Sb)//(N-2)
    for a, b in zip(A, B):
        if b < a - ans:
            ans = -1
            break

print(ans)
0