結果

問題 No.1120 Strange Teacher
ユーザー now4estnow4est
提出日時 2020-07-23 00:06:03
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 437 bytes
コンパイル時間 320 ms
コンパイル使用メモリ 10,832 KB
実行使用メモリ 39,356 KB
最終ジャッジ日時 2023-09-05 06:05:38
合計ジャッジ時間 7,812 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 129 ms
30,020 KB
testcase_10 AC 235 ms
39,356 KB
testcase_11 AC 250 ms
39,256 KB
testcase_12 AC 233 ms
39,260 KB
testcase_13 AC 178 ms
38,456 KB
testcase_14 AC 210 ms
38,396 KB
testcase_15 AC 175 ms
38,460 KB
testcase_16 AC 176 ms
38,440 KB
testcase_17 AC 174 ms
38,448 KB
testcase_18 TLE -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np
import sys

N = int(input())
A = np.array(input().split(), dtype=np.int64)
B = np.array(input().split(), dtype=np.int64)

C = B - A
m = abs(C.min())

count = 0
while count <= m:
    S = np.unique(C)
    if len(S) == 2 and S.sum() == 0:
        count += abs(S[0])
        print(count)
        sys.exit()

    D = np.full(N, abs(C.min() + C.max()))
    D[C.argmax()] *= -1
    C = C + D
    count += abs(D[0])

print(-1)
0