結果
| 問題 |
No.1120 Strange Teacher
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-04-16 20:06:12 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 86 ms / 1,000 ms |
| コード長 | 470 bytes |
| コンパイル時間 | 487 ms |
| コンパイル使用メモリ | 81,656 KB |
| 実行使用メモリ | 103,292 KB |
| 最終ジャッジ日時 | 2025-04-16 20:06:17 |
| 合計ジャッジ時間 | 5,342 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 |
ソースコード
N=int(input()) A=list(map(int,input().split())) B=list(map(int,input().split())) if N==2: if sum(A)==sum(B): print(abs(A[0]-B[0])) else: print(-1) else: sa=sum(A) sb=sum(B) if (sa-sb)%(N-2)!=0: print(-1) exit() if sa-sb<0: print(-1) exit() ans=(sa-sb)//(N-2) op=0 for i in range(N): if (A[i]+ans+B[i])%2==1: print(-1) exit() now=(B[i]-(A[i]-ans))//2 if now<0: print(-1) exit() op+=now if op!=ans: print(-1) else: print(ans)