結果

問題 No.1120 Strange Teacher
ユーザー NoneNone
提出日時 2021-02-25 13:04:35
言語 PyPy3
(7.3.13)
結果
WA  
実行時間 -
コード長 381 bytes
コンパイル時間 1,094 ms
コンパイル使用メモリ 81,712 KB
実行使用メモリ 103,068 KB
最終ジャッジ日時 2023-10-26 03:26:06
合計ジャッジ時間 4,628 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,556 KB
testcase_01 AC 37 ms
53,556 KB
testcase_02 AC 43 ms
59,548 KB
testcase_03 AC 46 ms
64,088 KB
testcase_04 AC 86 ms
103,060 KB
testcase_05 AC 84 ms
103,060 KB
testcase_06 AC 86 ms
103,068 KB
testcase_07 AC 89 ms
103,060 KB
testcase_08 AC 88 ms
103,060 KB
testcase_09 AC 39 ms
53,556 KB
testcase_10 AC 82 ms
101,428 KB
testcase_11 AC 82 ms
101,428 KB
testcase_12 AC 83 ms
101,428 KB
testcase_13 AC 82 ms
101,292 KB
testcase_14 AC 80 ms
101,292 KB
testcase_15 AC 80 ms
101,292 KB
testcase_16 AC 79 ms
101,296 KB
testcase_17 AC 83 ms
101,292 KB
testcase_18 AC 40 ms
53,556 KB
testcase_19 AC 90 ms
100,384 KB
testcase_20 AC 39 ms
53,556 KB
testcase_21 AC 37 ms
53,556 KB
testcase_22 AC 39 ms
53,556 KB
testcase_23 AC 38 ms
53,556 KB
testcase_24 AC 81 ms
100,564 KB
testcase_25 AC 39 ms
53,556 KB
testcase_26 WA -
testcase_27 AC 39 ms
53,556 KB
testcase_28 AC 38 ms
53,556 KB
testcase_29 AC 37 ms
53,556 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
A=list(map(int, input().split()))
B=list(map(int, input().split()))
SA=sum(A)
SB=sum(B)
if N==2:
    if SA!=SB:
        print(-1)
        exit()
    else:
        print(abs(A[0]-B[0]))
        exit()
if (SA-SB)%(N-2)!=0 or SA<SB:
    print(-1)
    exit()
k=(SA-SB)//(N-2)
for i in range(N):
    a,b=A[i]-k,B[i]
    if b-a<0:
        print(-1)
        exit()
print(k)
0