結果
問題 | No.1120 Strange Teacher |
ユーザー |
![]() |
提出日時 | 2024-04-11 13:24:18 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 432 bytes |
コンパイル時間 | 353 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 24,824 KB |
最終ジャッジ日時 | 2024-10-02 21:34:29 |
合計ジャッジ時間 | 4,567 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 WA * 3 |
ソースコード
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 b%2==b%2 for a,b in zip(A,B)): ans=cnt else: ans=-1 print(ans)