結果

問題 No.1120 Strange Teacher
ユーザー roarisroaris
提出日時 2020-07-24 21:28:38
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 414 bytes
コンパイル時間 701 ms
コンパイル使用メモリ 87,044 KB
実行使用メモリ 99,964 KB
最終ジャッジ日時 2023-09-08 03:23:35
合計ジャッジ時間 5,107 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,244 KB
testcase_01 AC 68 ms
71,152 KB
testcase_02 AC 73 ms
75,728 KB
testcase_03 AC 79 ms
76,444 KB
testcase_04 AC 116 ms
99,716 KB
testcase_05 AC 115 ms
99,964 KB
testcase_06 AC 114 ms
99,604 KB
testcase_07 AC 115 ms
99,792 KB
testcase_08 AC 116 ms
99,648 KB
testcase_09 AC 70 ms
71,344 KB
testcase_10 AC 108 ms
99,712 KB
testcase_11 AC 107 ms
99,676 KB
testcase_12 AC 106 ms
99,696 KB
testcase_13 AC 115 ms
99,604 KB
testcase_14 AC 114 ms
99,756 KB
testcase_15 AC 115 ms
99,704 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 69 ms
71,364 KB
testcase_19 AC 115 ms
98,148 KB
testcase_20 RE -
testcase_21 RE -
testcase_22 AC 68 ms
71,564 KB
testcase_23 AC 68 ms
71,572 KB
testcase_24 AC 111 ms
99,360 KB
testcase_25 AC 66 ms
71,236 KB
testcase_26 AC 69 ms
71,420 KB
testcase_27 AC 68 ms
71,268 KB
testcase_28 AC 69 ms
71,488 KB
testcase_29 AC 68 ms
71,240 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = [B[i]-A[i] for i in range(N)]
D = []

for i in range(1, N):
    if (C[0]-C[i])%2==1:
        print(-1)
        exit()
    
    D.append((C[0]-C[i])//2)

S = sum(D)

if (S-C[0])%(N-2)!=0:
    print(-1)
    exit()

x = (S-C[0])//(N-2)
ans = x

for Di in D:
    ans += x-Di

print(ans)
0