結果

問題 No.2248 max(C)-min(C)
ユーザー 👑 colognecologne
提出日時 2023-03-21 13:56:30
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 542 bytes
コンパイル時間 190 ms
コンパイル使用メモリ 81,624 KB
実行使用メモリ 166,124 KB
最終ジャッジ日時 2023-10-18 18:24:34
合計ジャッジ時間 34,773 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,584 KB
testcase_01 WA -
testcase_02 AC 37 ms
53,584 KB
testcase_03 AC 46 ms
61,796 KB
testcase_04 AC 43 ms
59,336 KB
testcase_05 AC 39 ms
53,584 KB
testcase_06 AC 56 ms
66,508 KB
testcase_07 AC 56 ms
68,564 KB
testcase_08 AC 58 ms
68,584 KB
testcase_09 AC 58 ms
68,564 KB
testcase_10 AC 38 ms
53,584 KB
testcase_11 AC 58 ms
68,564 KB
testcase_12 AC 46 ms
61,724 KB
testcase_13 AC 54 ms
66,528 KB
testcase_14 AC 57 ms
68,564 KB
testcase_15 AC 60 ms
68,596 KB
testcase_16 AC 47 ms
61,796 KB
testcase_17 AC 58 ms
68,568 KB
testcase_18 AC 309 ms
134,048 KB
testcase_19 AC 87 ms
80,660 KB
testcase_20 AC 348 ms
147,000 KB
testcase_21 AC 348 ms
143,868 KB
testcase_22 AC 247 ms
104,172 KB
testcase_23 AC 173 ms
95,836 KB
testcase_24 AC 102 ms
84,904 KB
testcase_25 AC 306 ms
136,460 KB
testcase_26 AC 296 ms
124,644 KB
testcase_27 AC 305 ms
136,064 KB
testcase_28 AC 81 ms
78,832 KB
testcase_29 AC 306 ms
131,160 KB
testcase_30 AC 157 ms
94,776 KB
testcase_31 AC 346 ms
146,996 KB
testcase_32 WA -
testcase_33 AC 146 ms
94,316 KB
testcase_34 AC 377 ms
147,296 KB
testcase_35 AC 362 ms
147,152 KB
testcase_36 AC 346 ms
146,992 KB
testcase_37 AC 197 ms
99,736 KB
testcase_38 AC 1,609 ms
137,448 KB
testcase_39 AC 1,618 ms
137,328 KB
testcase_40 AC 1,599 ms
136,960 KB
testcase_41 AC 1,300 ms
119,172 KB
testcase_42 AC 1,558 ms
136,468 KB
testcase_43 AC 1,380 ms
119,972 KB
testcase_44 AC 1,566 ms
137,412 KB
testcase_45 AC 1,236 ms
115,552 KB
testcase_46 AC 601 ms
100,816 KB
testcase_47 AC 1,582 ms
137,448 KB
testcase_48 AC 1,426 ms
149,848 KB
testcase_49 AC 2,369 ms
166,124 KB
testcase_50 AC 2,379 ms
165,084 KB
testcase_51 AC 2,281 ms
164,592 KB
testcase_52 AC 2,245 ms
165,016 KB
testcase_53 AC 326 ms
85,528 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import heapq


def main():
    N = int(input())
    *A, = map(int, input().split())
    *B, = map(int, input().split())
    Q = []
    for i in range(N):
        heapq.heappush(Q, sorted([A[i], B[i], (A[i]+B[i])//2]))
    mx, mn = max(Q)[0], Q[0][0]
    ans = mx-mn
    while True:
        a = heapq.heappop(Q)
        if len(a) == 1:
            print(ans)
            return
        a = a[1:]
        mx = max(mx, a[0])
        mn = Q[0][0]
        ans = min(ans, mx-mn)
        heapq.heappush(Q, a)


if __name__ == '__main__':
    main()
0