結果
| 問題 |
No.1120 Strange Teacher
|
| コンテスト | |
| ユーザー |
maspy
|
| 提出日時 | 2020-07-10 23:50:39 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 636 bytes |
| コンパイル時間 | 220 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 47,844 KB |
| 最終ジャッジ日時 | 2024-10-11 20:56:09 |
| 合計ジャッジ時間 | 18,418 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 26 WA * 1 |
ソースコード
# N = 2 の場合を適当に嘘にした解法。WA になるべき。
import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
A = np.array(readline().split(), np.int64)
B = np.array(readline().split(), np.int64)
def main(A, B):
N = len(A)
SA, SB = A.sum(), B.sum()
if N == 2:
# if SA != SB:
# return -1
return np.abs(A - B).sum() // 2
K = (SA - SB) // (N - 2)
A -= K
x = B - A
if np.all((x >= 0) & (x % 2 == 0)):
return K
else:
return -1
print(main(A, B))
maspy