結果
| 問題 |
No.1120 Strange Teacher
|
| コンテスト | |
| ユーザー |
takakin
|
| 提出日時 | 2020-07-25 22:15:51 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 178 ms / 1,000 ms |
| コード長 | 485 bytes |
| コンパイル時間 | 126 ms |
| コンパイル使用メモリ | 12,928 KB |
| 実行使用メモリ | 25,288 KB |
| 最終ジャッジ日時 | 2024-06-27 18:06:26 |
| 合計ジャッジ時間 | 3,946 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 |
ソースコード
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 or (B[i]-A[i]+ans)<0: Chk=False ct+=(B[i]-A[i]+ans)//2 if Chk==False or ct!=ans: print(-1) else: print(ans)
takakin