結果
| 問題 |
No.1120 Strange Teacher
|
| コンテスト | |
| ユーザー |
vwxyz
|
| 提出日時 | 2024-04-11 13:25:02 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 432 bytes |
| コンパイル時間 | 96 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 24,952 KB |
| 最終ジャッジ日時 | 2024-10-02 21:34:33 |
| 合計ジャッジ時間 | 3,458 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 WA * 2 |
ソースコード
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
D=[a-b for a,b in zip(A,B)]
if N==2:
if sum(D)==0:
ans=0
else:
ans=-1
else:
if sum(D)<0 or sum(D)%(N-2):
ans=-1
else:
cnt=sum(D)//(N-2)
for i in range(N):
A[i]-=cnt
if all(a<=b and a%2==b%2 for a,b in zip(A,B)):
ans=cnt
else:
ans=-1
print(ans)
vwxyz