結果

問題 No.1120 Strange Teacher
ユーザー maspymaspy
提出日時 2020-07-10 23:44:55
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 634 bytes
コンパイル時間 75 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 47,992 KB
最終ジャッジ日時 2024-04-20 02:04:07
合計ジャッジ時間 16,455 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 473 ms
44,220 KB
testcase_01 AC 463 ms
44,224 KB
testcase_02 AC 470 ms
44,220 KB
testcase_03 AC 474 ms
44,100 KB
testcase_04 AC 508 ms
47,568 KB
testcase_05 AC 513 ms
47,460 KB
testcase_06 AC 518 ms
47,556 KB
testcase_07 AC 507 ms
47,860 KB
testcase_08 AC 506 ms
47,972 KB
testcase_09 AC 461 ms
44,228 KB
testcase_10 AC 516 ms
47,600 KB
testcase_11 AC 520 ms
47,848 KB
testcase_12 AC 521 ms
47,968 KB
testcase_13 AC 520 ms
47,572 KB
testcase_14 AC 520 ms
47,860 KB
testcase_15 AC 531 ms
47,988 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 487 ms
44,600 KB
testcase_19 AC 527 ms
46,912 KB
testcase_20 AC 478 ms
44,096 KB
testcase_21 AC 470 ms
44,092 KB
testcase_22 AC 465 ms
44,488 KB
testcase_23 AC 463 ms
44,472 KB
testcase_24 AC 504 ms
46,908 KB
testcase_25 AC 462 ms
44,096 KB
testcase_26 AC 461 ms
44,220 KB
testcase_27 AC 467 ms
44,348 KB
testcase_28 AC 456 ms
44,224 KB
testcase_29 AC 467 ms
44,228 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# 嘘解法の提出。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)):
    if np.all(x % 2 == 0):
        return K
    else:
        return -1

print(main(A, B))
0