結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,776 KB
testcase_01 AC 16 ms
7,936 KB
testcase_02 AC 17 ms
8,200 KB
testcase_03 AC 26 ms
9,632 KB
testcase_04 AC 120 ms
23,676 KB
testcase_05 AC 119 ms
23,720 KB
testcase_06 AC 120 ms
23,516 KB
testcase_07 AC 120 ms
23,680 KB
testcase_08 AC 122 ms
23,520 KB
testcase_09 AC 16 ms
8,128 KB
testcase_10 AC 78 ms
23,732 KB
testcase_11 AC 78 ms
23,652 KB
testcase_12 AC 77 ms
23,640 KB
testcase_13 AC 78 ms
23,660 KB
testcase_14 AC 78 ms
23,708 KB
testcase_15 AC 78 ms
23,720 KB
testcase_16 AC 79 ms
23,712 KB
testcase_17 AC 78 ms
23,628 KB
testcase_18 AC 16 ms
7,912 KB
testcase_19 AC 122 ms
23,896 KB
testcase_20 AC 16 ms
8,020 KB
testcase_21 AC 16 ms
8,256 KB
testcase_22 AC 16 ms
8,272 KB
testcase_23 AC 16 ms
7,764 KB
testcase_24 AC 117 ms
20,696 KB
testcase_25 AC 16 ms
8,088 KB
testcase_26 AC 16 ms
8,056 KB
testcase_27 AC 16 ms
7,824 KB
testcase_28 AC 16 ms
7,764 KB
testcase_29 AC 16 ms
8,020 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.py:12: SyntaxWarning: invalid decimal literal
  if(B+R-A)%2or B+R<A: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):
 A,B=a[i],b[i]
 if(B+R-A)%2or B+R<A:exit(print(-1))
print(R)
0