結果
問題 | No.1120 Strange Teacher |
ユーザー |
|
提出日時 | 2022-01-04 22:13:37 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 96 ms / 1,000 ms |
コード長 | 585 bytes |
コンパイル時間 | 1,077 ms |
コンパイル使用メモリ | 82,168 KB |
実行使用メモリ | 103,880 KB |
最終ジャッジ日時 | 2024-10-15 00:53:42 |
合計ジャッジ時間 | 5,348 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
ソースコード
N = int(input())lsA = list(map(int,input().split()))lsB = list(map(int,input().split()))ls = []for i in range(N):ls.append(lsA[i]-lsB[i])if N == 2:if sum(lsA) != sum(lsB):print(-1)exit()print(abs(lsA[0]-lsB[0]))exit()if sum(ls) % (N-2) != 0:print(-1)exit()kai = sum(ls)//(N-2)for i in range(N):ls[i] -= kaicnt = 0for i in range(N):if ls[i] % 2 != 0:print(-1)exit()if ls[i] > 0:print(-1)exit()cnt += -ls[i]//2if cnt > kai:print(-1)exit()print(kai)