結果
| 問題 |
No.1120 Strange Teacher
|
| コンテスト | |
| ユーザー |
takakin
|
| 提出日時 | 2020-07-25 21:52:45 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 470 bytes |
| コンパイル時間 | 81 ms |
| コンパイル使用メモリ | 12,800 KB |
| 実行使用メモリ | 25,276 KB |
| 最終ジャッジ日時 | 2024-06-27 16:52:12 |
| 合計ジャッジ時間 | 5,056 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 WA * 2 |
ソースコード
import sys input=lambda: sys.stdin.readline().rstrip() n=int(input()) A=[int(i) for i in input().split()] B=[int(i) for i in input().split()] if n==2: if sum(A)==sum(B): print(abs(A[0]-B[0])) else: print(-1) else: d=sum(A)-sum(B) if d<0 or d%(n-2)!=0: print(-1) else: ans=d//(n-2) ct=0 Chk=True for i in range(n): if (B[i]-A[i]+ans)%2!=0: Chk=False ct+=(B[i]-A[i]+ans)//2 if Chk==False or ct!=ans: print(-1) else: print(ans)
takakin