結果

問題 No.2248 max(C)-min(C)
ユーザー titiatitia
提出日時 2023-03-17 22:00:04
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 544 bytes
コンパイル時間 204 ms
コンパイル使用メモリ 81,828 KB
実行使用メモリ 143,140 KB
最終ジャッジ日時 2023-10-18 14:41:28
合計ジャッジ時間 89,069 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,496 KB
testcase_01 AC 39 ms
53,496 KB
testcase_02 AC 38 ms
53,496 KB
testcase_03 AC 92 ms
76,060 KB
testcase_04 AC 77 ms
73,380 KB
testcase_05 AC 66 ms
68,528 KB
testcase_06 AC 112 ms
76,348 KB
testcase_07 AC 111 ms
76,616 KB
testcase_08 AC 118 ms
76,364 KB
testcase_09 AC 115 ms
76,448 KB
testcase_10 AC 62 ms
66,432 KB
testcase_11 AC 113 ms
76,424 KB
testcase_12 AC 94 ms
76,084 KB
testcase_13 AC 106 ms
76,348 KB
testcase_14 AC 113 ms
76,416 KB
testcase_15 AC 112 ms
76,380 KB
testcase_16 AC 88 ms
76,084 KB
testcase_17 AC 109 ms
76,576 KB
testcase_18 AC 2,791 ms
128,020 KB
testcase_19 AC 313 ms
82,128 KB
testcase_20 TLE -
testcase_21 TLE -
testcase_22 AC 2,008 ms
115,352 KB
testcase_23 AC 1,169 ms
105,120 KB
testcase_24 AC 450 ms
84,704 KB
testcase_25 AC 2,982 ms
128,536 KB
testcase_26 AC 2,626 ms
124,212 KB
testcase_27 AC 2,951 ms
128,600 KB
testcase_28 AC 260 ms
80,620 KB
testcase_29 AC 2,612 ms
125,976 KB
testcase_30 AC 926 ms
94,736 KB
testcase_31 TLE -
testcase_32 AC 508 ms
86,452 KB
testcase_33 AC 835 ms
92,796 KB
testcase_34 TLE -
testcase_35 TLE -
testcase_36 TLE -
testcase_37 AC 1,496 ms
111,160 KB
testcase_38 TLE -
testcase_39 TLE -
testcase_40 TLE -
testcase_41 AC 2,652 ms
127,680 KB
testcase_42 TLE -
testcase_43 AC 2,804 ms
129,756 KB
testcase_44 TLE -
testcase_45 AC 2,404 ms
122,352 KB
testcase_46 AC 1,150 ms
99,636 KB
testcase_47 TLE -
testcase_48 AC 1,774 ms
136,548 KB
testcase_49 TLE -
testcase_50 TLE -
testcase_51 AC 2,995 ms
142,580 KB
testcase_52 AC 2,958 ms
143,020 KB
testcase_53 AC 432 ms
86,160 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
from heapq import heappop,heappush,heapify


N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))

X=[]

for i in range(N):
    Y=[A[i],B[i],(A[i]+B[i])//2]
    Y.sort()
    X.append(tuple(Y))

ANS=1<<31

MAX=0
for x in X:
    MAX=max(MAX,x[0])

X.sort()
MIN=1<<31

while X:
    k=list(heappop(X))

    ANS=min(ANS,MAX-min(MIN,k[0]))

    u=k.pop(0)

    if len(k)==0:
        MIN=min(MIN,u)
        
    else:
        heappush(X,tuple(k))
        MAX=max(MAX,k[0])

print(ANS)
0