結果

問題 No.1120 Strange Teacher
ユーザー ShirotsumeShirotsume
提出日時 2022-07-19 23:25:22
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 497 bytes
コンパイル時間 460 ms
コンパイル使用メモリ 86,804 KB
実行使用メモリ 101,144 KB
最終ジャッジ日時 2023-09-14 20:28:49
合計ジャッジ時間 6,953 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,124 KB
testcase_01 AC 74 ms
71,444 KB
testcase_02 AC 80 ms
75,572 KB
testcase_03 AC 82 ms
76,384 KB
testcase_04 AC 117 ms
101,084 KB
testcase_05 AC 117 ms
101,028 KB
testcase_06 AC 118 ms
101,092 KB
testcase_07 AC 116 ms
101,012 KB
testcase_08 AC 117 ms
100,988 KB
testcase_09 AC 73 ms
71,160 KB
testcase_10 AC 113 ms
101,028 KB
testcase_11 AC 113 ms
100,956 KB
testcase_12 AC 113 ms
101,052 KB
testcase_13 AC 113 ms
101,140 KB
testcase_14 AC 114 ms
101,016 KB
testcase_15 AC 114 ms
101,144 KB
testcase_16 AC 113 ms
101,076 KB
testcase_17 AC 114 ms
101,120 KB
testcase_18 AC 73 ms
71,320 KB
testcase_19 AC 115 ms
99,420 KB
testcase_20 RE -
testcase_21 RE -
testcase_22 AC 74 ms
71,304 KB
testcase_23 AC 73 ms
71,308 KB
testcase_24 AC 113 ms
100,460 KB
testcase_25 RE -
testcase_26 AC 73 ms
71,252 KB
testcase_27 AC 74 ms
71,248 KB
testcase_28 AC 74 ms
71,304 KB
testcase_29 AC 73 ms
71,144 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())
INF = 2 ** 63 - 1
mod = 998244353
n = ii()
a = li()

b = li()

time = sum(a) - sum(b)

if time % (n - 2) != 0:
    print(-1)
    exit()

time //= n - 2
cnt = 0
for i in range(n):
    a[i] -= time
    if b[i] < a[i] or (b[i] - a[i]) % 2:
        print(-1)
        exit()
    cnt += (b[i] - a[i]) // 2
if cnt == time:
    print(time)
else:
    print(-1)
0