結果

問題 No.1120 Strange Teacher
ユーザー 👑 rin204rin204
提出日時 2022-07-04 16:40:04
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 433 bytes
コンパイル時間 738 ms
コンパイル使用メモリ 86,980 KB
実行使用メモリ 101,352 KB
最終ジャッジ日時 2023-08-21 00:24:03
合計ジャッジ時間 6,701 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,288 KB
testcase_01 AC 73 ms
71,452 KB
testcase_02 AC 78 ms
75,572 KB
testcase_03 AC 81 ms
76,288 KB
testcase_04 AC 119 ms
100,884 KB
testcase_05 AC 118 ms
101,180 KB
testcase_06 AC 118 ms
100,916 KB
testcase_07 AC 118 ms
100,900 KB
testcase_08 AC 116 ms
101,012 KB
testcase_09 AC 71 ms
71,476 KB
testcase_10 AC 113 ms
101,352 KB
testcase_11 AC 113 ms
101,000 KB
testcase_12 AC 112 ms
100,996 KB
testcase_13 AC 110 ms
101,192 KB
testcase_14 AC 110 ms
101,040 KB
testcase_15 AC 111 ms
100,884 KB
testcase_16 AC 114 ms
101,020 KB
testcase_17 AC 113 ms
100,880 KB
testcase_18 AC 69 ms
71,288 KB
testcase_19 AC 118 ms
99,576 KB
testcase_20 AC 71 ms
71,412 KB
testcase_21 AC 69 ms
70,944 KB
testcase_22 AC 70 ms
71,304 KB
testcase_23 AC 70 ms
71,416 KB
testcase_24 AC 114 ms
100,208 KB
testcase_25 AC 70 ms
71,528 KB
testcase_26 WA -
testcase_27 AC 70 ms
71,344 KB
testcase_28 AC 69 ms
71,320 KB
testcase_29 AC 69 ms
71,364 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
tota = sum(A)
totb = sum(B)
if n == 2:
    if tota == totb:
        print(abs(A[0] - B[0]))
    else:
        print(-1)
    exit()
d = tota - totb
if d < 0:
    print(-1)
    exit()
if d % (n - 2) != 0:
    print(-1)
    exit()
cnt = d // (n - 2)
A = [a - cnt for a in A]
if any(a > b for a, b in zip(A, B)):
    print(-1)
else:
    print(cnt)
0