結果

問題 No.1120 Strange Teacher
ユーザー stngstng
提出日時 2022-09-04 17:43:04
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 477 bytes
コンパイル時間 275 ms
コンパイル使用メモリ 82,276 KB
実行使用メモリ 94,984 KB
最終ジャッジ日時 2024-04-29 17:56:19
合計ジャッジ時間 3,450 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 34 ms
51,456 KB
testcase_10 AC 86 ms
91,392 KB
testcase_11 AC 84 ms
91,392 KB
testcase_12 AC 86 ms
91,648 KB
testcase_13 AC 78 ms
91,904 KB
testcase_14 AC 76 ms
91,648 KB
testcase_15 AC 72 ms
91,008 KB
testcase_16 AC 78 ms
91,796 KB
testcase_17 AC 71 ms
90,752 KB
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 AC 34 ms
51,968 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 38 ms
51,968 KB
testcase_26 AC 38 ms
51,712 KB
testcase_27 RE -
testcase_28 RE -
testcase_29 AC 35 ms
52,352 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]

li = [0]*n
ans = 0
for i in range(n):
    li[i] = b[i]-a[i]

li.sort(reverse=True)
if li[0] != -li[1]:
    print(-1)
    exit()
else:
    print(a[n])
    ans = li[0]
    now = -li[0]

for i in range(2,n):
    if now == -li[i]:
        continue
    elif abs(now-li[i]) % i == 0:
        ans += abs(now-li[i])
        now = -li[i]
    else:
        print(-1)
        exit()

print(ans)
0