結果

問題 No.2248 max(C)-min(C)
ユーザー yabityabit
提出日時 2023-06-30 12:42:03
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 614 bytes
コンパイル時間 1,424 ms
コンパイル使用メモリ 86,068 KB
実行使用メモリ 174,664 KB
最終ジャッジ日時 2023-09-21 06:29:34
合計ジャッジ時間 39,890 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 94 ms
71,636 KB
testcase_01 AC 92 ms
71,068 KB
testcase_02 AC 90 ms
71,432 KB
testcase_03 AC 176 ms
79,004 KB
testcase_04 AC 156 ms
78,372 KB
testcase_05 AC 140 ms
78,248 KB
testcase_06 AC 186 ms
79,232 KB
testcase_07 AC 190 ms
79,332 KB
testcase_08 AC 185 ms
79,308 KB
testcase_09 AC 190 ms
79,200 KB
testcase_10 AC 133 ms
77,768 KB
testcase_11 AC 185 ms
79,252 KB
testcase_12 AC 163 ms
79,224 KB
testcase_13 AC 178 ms
79,292 KB
testcase_14 AC 190 ms
79,164 KB
testcase_15 AC 192 ms
79,092 KB
testcase_16 AC 165 ms
78,584 KB
testcase_17 AC 185 ms
79,248 KB
testcase_18 AC 2,932 ms
159,880 KB
testcase_19 AC 605 ms
88,160 KB
testcase_20 TLE -
testcase_21 TLE -
testcase_22 AC 2,115 ms
132,624 KB
testcase_23 AC 1,314 ms
128,288 KB
testcase_24 AC 563 ms
93,172 KB
testcase_25 AC 2,934 ms
168,156 KB
testcase_26 AC 2,618 ms
156,368 KB
testcase_27 AC 2,914 ms
167,732 KB
testcase_28 AC 366 ms
85,232 KB
testcase_29 AC 2,719 ms
158,460 KB
testcase_30 AC 1,051 ms
116,500 KB
testcase_31 TLE -
testcase_32 AC 626 ms
95,536 KB
testcase_33 AC 973 ms
113,272 KB
testcase_34 TLE -
testcase_35 TLE -
testcase_36 TLE -
testcase_37 AC 1,677 ms
126,076 KB
testcase_38 TLE -
testcase_39 TLE -
testcase_40 TLE -
testcase_41 AC 2,971 ms
146,188 KB
testcase_42 TLE -
testcase_43 AC 2,999 ms
156,328 KB
testcase_44 TLE -
testcase_45 AC 2,619 ms
139,576 KB
testcase_46 AC 1,332 ms
126,688 KB
testcase_47 TLE -
testcase_48 AC 1,834 ms
164,388 KB
testcase_49 TLE -
testcase_50 TLE -
testcase_51 TLE -
testcase_52 TLE -
testcase_53 AC 602 ms
93,296 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from copy import deepcopy
import heapq
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
que = []
for i,(a,b) in enumerate(zip(A,B)):
    que.append((a, i))
    que.append((b, i))
    que.append(((a+b)//2, i))
que2 = deepcopy(que)
que2.sort()
heapq.heapify(que)
ans = 10**18
r = 0
rs = [0]*N
for d, idx in que2:
    # print(d,idx,que,ans,rs)
    while que and r != N:
        e, idy = heapq.heappop(que)
        rs[idy] += 1
        if rs[idy] == 1:
            r += 1
    if r == N:
        ans = min(ans, e-d)
    rs[idx] -= 1
    if rs[idx] == 0:
        r -= 1
print(ans)
0