結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,916 KB
testcase_01 AC 15 ms
7,904 KB
testcase_02 AC 17 ms
8,332 KB
testcase_03 AC 26 ms
9,784 KB
testcase_04 AC 107 ms
23,556 KB
testcase_05 AC 111 ms
23,596 KB
testcase_06 AC 107 ms
23,640 KB
testcase_07 AC 108 ms
23,608 KB
testcase_08 AC 107 ms
23,660 KB
testcase_09 AC 15 ms
8,092 KB
testcase_10 AC 72 ms
23,604 KB
testcase_11 AC 71 ms
23,684 KB
testcase_12 AC 71 ms
23,732 KB
testcase_13 AC 71 ms
23,692 KB
testcase_14 AC 71 ms
23,512 KB
testcase_15 AC 71 ms
23,520 KB
testcase_16 AC 73 ms
23,568 KB
testcase_17 AC 73 ms
23,660 KB
testcase_18 AC 15 ms
7,852 KB
testcase_19 AC 111 ms
23,840 KB
testcase_20 AC 15 ms
8,168 KB
testcase_21 AC 15 ms
8,268 KB
testcase_22 AC 15 ms
8,168 KB
testcase_23 AC 14 ms
7,944 KB
testcase_24 AC 107 ms
20,708 KB
testcase_25 AC 15 ms
8,220 KB
testcase_26 AC 15 ms
8,092 KB
testcase_27 AC 14 ms
7,760 KB
testcase_28 AC 14 ms
7,776 KB
testcase_29 AC 14 ms
8,056 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.py:11: SyntaxWarning: invalid decimal literal
  if(b[i]+R-a[i])%2or b[i]+R<a[i]:exit(P(-1))

ソースコード

diff #

I,S,P=input,sum,print
n=int(I())
def L():return list(map(int,I().split()))
a,b=L(),L()
if n==2:
 if S(a)!=S(b):exit(P(-1))
 else:exit(P(abs(a[0]-b[0])))
if S(a)<S(b)or(S(a)-S(b))%(n-2):exit(P(-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(P(-1))
P(R)
0