結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 12 ms
7,756 KB
testcase_01 AC 12 ms
7,832 KB
testcase_02 AC 13 ms
8,240 KB
testcase_03 AC 20 ms
9,788 KB
testcase_04 AC 94 ms
23,592 KB
testcase_05 AC 95 ms
23,644 KB
testcase_06 AC 95 ms
23,676 KB
testcase_07 AC 98 ms
23,472 KB
testcase_08 AC 94 ms
23,648 KB
testcase_09 AC 14 ms
8,220 KB
testcase_10 AC 63 ms
23,608 KB
testcase_11 AC 61 ms
23,728 KB
testcase_12 AC 61 ms
23,800 KB
testcase_13 AC 60 ms
23,636 KB
testcase_14 AC 61 ms
23,644 KB
testcase_15 AC 60 ms
23,584 KB
testcase_16 AC 62 ms
23,644 KB
testcase_17 AC 63 ms
23,652 KB
testcase_18 AC 14 ms
7,924 KB
testcase_19 AC 94 ms
23,868 KB
testcase_20 AC 13 ms
8,124 KB
testcase_21 AC 13 ms
8,216 KB
testcase_22 AC 13 ms
8,236 KB
testcase_23 AC 12 ms
7,836 KB
testcase_24 AC 92 ms
20,720 KB
testcase_25 AC 13 ms
8,124 KB
testcase_26 AC 12 ms
8,124 KB
testcase_27 AC 14 ms
7,760 KB
testcase_28 AC 13 ms
7,928 KB
testcase_29 AC 14 ms
8,092 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.py:10: SyntaxWarning: invalid decimal literal
  if (b[i]+R-a[i])%2or b[i]+R<a[i]:exit(print(-1))

ソースコード

diff #

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