結果

問題 No.2248 max(C)-min(C)
ユーザー yabityabit
提出日時 2023-06-30 12:47:16
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 614 bytes
コンパイル時間 329 ms
コンパイル使用メモリ 87,080 KB
実行使用メモリ 174,952 KB
最終ジャッジ日時 2023-09-21 06:35:42
合計ジャッジ時間 90,923 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 89 ms
71,516 KB
testcase_01 AC 89 ms
71,400 KB
testcase_02 AC 90 ms
71,708 KB
testcase_03 AC 161 ms
79,244 KB
testcase_04 AC 150 ms
78,560 KB
testcase_05 AC 134 ms
78,656 KB
testcase_06 AC 178 ms
79,320 KB
testcase_07 AC 182 ms
79,616 KB
testcase_08 AC 181 ms
79,424 KB
testcase_09 AC 180 ms
79,316 KB
testcase_10 AC 127 ms
77,960 KB
testcase_11 AC 181 ms
79,364 KB
testcase_12 AC 156 ms
79,216 KB
testcase_13 AC 170 ms
79,560 KB
testcase_14 AC 182 ms
79,452 KB
testcase_15 AC 181 ms
79,336 KB
testcase_16 AC 157 ms
78,752 KB
testcase_17 AC 178 ms
79,356 KB
testcase_18 AC 2,730 ms
159,140 KB
testcase_19 AC 417 ms
88,596 KB
testcase_20 TLE -
testcase_21 AC 2,836 ms
172,296 KB
testcase_22 AC 1,962 ms
132,552 KB
testcase_23 AC 1,226 ms
128,252 KB
testcase_24 AC 546 ms
93,100 KB
testcase_25 AC 2,732 ms
168,268 KB
testcase_26 AC 2,430 ms
156,344 KB
testcase_27 AC 2,677 ms
167,436 KB
testcase_28 AC 356 ms
85,236 KB
testcase_29 AC 2,503 ms
158,372 KB
testcase_30 AC 992 ms
116,752 KB
testcase_31 TLE -
testcase_32 AC 623 ms
95,600 KB
testcase_33 AC 919 ms
113,548 KB
testcase_34 TLE -
testcase_35 TLE -
testcase_36 TLE -
testcase_37 AC 1,565 ms
126,032 KB
testcase_38 TLE -
testcase_39 TLE -
testcase_40 TLE -
testcase_41 AC 2,618 ms
146,312 KB
testcase_42 TLE -
testcase_43 AC 2,706 ms
156,108 KB
testcase_44 TLE -
testcase_45 AC 2,384 ms
139,700 KB
testcase_46 AC 1,210 ms
126,412 KB
testcase_47 TLE -
testcase_48 AC 1,798 ms
164,280 KB
testcase_49 TLE -
testcase_50 TLE -
testcase_51 TLE -
testcase_52 TLE -
testcase_53 AC 563 ms
93,240 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