結果

問題 No.2248 max(C)-min(C)
ユーザー yabityabit
提出日時 2023-06-30 12:46:35
言語 PyPy3
(7.3.15)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 614 bytes
コンパイル時間 1,858 ms
コンパイル使用メモリ 86,716 KB
実行使用メモリ 175,048 KB
最終ジャッジ日時 2023-09-21 06:34:02
合計ジャッジ時間 95,534 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 91 ms
71,408 KB
testcase_01 AC 92 ms
71,560 KB
testcase_02 AC 91 ms
71,584 KB
testcase_03 AC 173 ms
79,128 KB
testcase_04 AC 153 ms
78,560 KB
testcase_05 AC 137 ms
78,616 KB
testcase_06 AC 179 ms
79,096 KB
testcase_07 AC 186 ms
79,448 KB
testcase_08 AC 184 ms
79,532 KB
testcase_09 AC 183 ms
79,172 KB
testcase_10 AC 126 ms
77,952 KB
testcase_11 AC 183 ms
79,192 KB
testcase_12 AC 159 ms
79,124 KB
testcase_13 AC 173 ms
79,572 KB
testcase_14 AC 185 ms
79,224 KB
testcase_15 AC 187 ms
79,240 KB
testcase_16 AC 157 ms
78,616 KB
testcase_17 AC 181 ms
79,364 KB
testcase_18 AC 2,895 ms
159,424 KB
testcase_19 AC 469 ms
88,692 KB
testcase_20 TLE -
testcase_21 TLE -
testcase_22 AC 2,125 ms
132,596 KB
testcase_23 AC 1,320 ms
128,304 KB
testcase_24 AC 558 ms
93,128 KB
testcase_25 AC 2,940 ms
168,292 KB
testcase_26 AC 2,582 ms
156,368 KB
testcase_27 AC 2,864 ms
167,628 KB
testcase_28 AC 357 ms
85,184 KB
testcase_29 AC 2,695 ms
158,828 KB
testcase_30 AC 1,042 ms
116,536 KB
testcase_31 TLE -
testcase_32 AC 619 ms
95,636 KB
testcase_33 AC 959 ms
113,548 KB
testcase_34 TLE -
testcase_35 TLE -
testcase_36 TLE -
testcase_37 AC 1,632 ms
125,876 KB
testcase_38 TLE -
testcase_39 TLE -
testcase_40 TLE -
testcase_41 AC 2,759 ms
146,280 KB
testcase_42 TLE -
testcase_43 AC 2,791 ms
156,224 KB
testcase_44 TLE -
testcase_45 AC 2,507 ms
139,748 KB
testcase_46 AC 1,278 ms
126,556 KB
testcase_47 TLE -
testcase_48 AC 1,788 ms
164,264 KB
testcase_49 TLE -
testcase_50 TLE -
testcase_51 TLE -
testcase_52 TLE -
testcase_53 AC 581 ms
93,580 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