結果

問題 No.1120 Strange Teacher
ユーザー NatsubiSoganNatsubiSogan
提出日時 2020-11-10 23:47:07
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 102 ms / 1,000 ms
コード長 298 bytes
コンパイル時間 94 ms
コンパイル使用メモリ 10,900 KB
実行使用メモリ 23,752 KB
最終ジャッジ日時 2023-09-30 00:16:20
合計ジャッジ時間 2,807 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 13 ms
7,940 KB
testcase_01 AC 13 ms
7,824 KB
testcase_02 AC 13 ms
8,324 KB
testcase_03 AC 23 ms
9,816 KB
testcase_04 AC 98 ms
23,592 KB
testcase_05 AC 102 ms
23,568 KB
testcase_06 AC 100 ms
23,468 KB
testcase_07 AC 101 ms
23,532 KB
testcase_08 AC 94 ms
23,644 KB
testcase_09 AC 13 ms
8,048 KB
testcase_10 AC 66 ms
23,736 KB
testcase_11 AC 66 ms
23,736 KB
testcase_12 AC 67 ms
23,700 KB
testcase_13 AC 65 ms
23,648 KB
testcase_14 AC 62 ms
23,564 KB
testcase_15 AC 62 ms
23,516 KB
testcase_16 AC 65 ms
23,568 KB
testcase_17 AC 64 ms
23,560 KB
testcase_18 AC 14 ms
7,792 KB
testcase_19 AC 100 ms
23,752 KB
testcase_20 AC 13 ms
8,156 KB
testcase_21 AC 13 ms
8,260 KB
testcase_22 AC 13 ms
8,080 KB
testcase_23 AC 12 ms
7,840 KB
testcase_24 AC 94 ms
20,604 KB
testcase_25 AC 14 ms
8,152 KB
testcase_26 AC 13 ms
8,156 KB
testcase_27 AC 13 ms
7,792 KB
testcase_28 AC 14 ms
7,760 KB
testcase_29 AC 13 ms
8,080 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.py:11: SyntaxWarning: invalid decimal literal
  if(b[i]+R-a[i])%2or b[i]+R<a[i]:exit(print(-1))

ソースコード

diff #

I,S=input,sum
n=int(I())
def L():return list(map(int,I().split()))
a,b=L(),L()
if n==2:
 if S(a)!=S(b):exit(print(-1))
 else:exit(print(abs(a[0]-b[0])))
if S(a)<S(b)or(S(a)-S(b))%(n-2):exit(print(-1))
R=(S(a)-S(b))//(n-2)
for i in range(n):
 if(b[i]+R-a[i])%2or b[i]+R<a[i]:exit(print(-1))
print(R)
0