結果
| 問題 | No.1120 Strange Teacher |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-04-16 20:06:12 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 79 ms / 1,000 ms |
| コード長 | 470 bytes |
| 記録 | |
| コンパイル時間 | 245 ms |
| コンパイル使用メモリ | 95,464 KB |
| 実行使用メモリ | 112,256 KB |
| 最終ジャッジ日時 | 2026-07-09 16:45:43 |
| 合計ジャッジ時間 | 5,048 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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)