結果

問題 No.2248 max(C)-min(C)
ユーザー titiatitia
提出日時 2023-03-17 21:52:15
言語 PyPy3
(7.3.15)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 546 bytes
コンパイル時間 166 ms
コンパイル使用メモリ 81,828 KB
実行使用メモリ 143,056 KB
最終ジャッジ日時 2023-10-18 14:28:55
合計ジャッジ時間 91,348 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,408 KB
testcase_01 AC 39 ms
53,408 KB
testcase_02 AC 40 ms
53,408 KB
testcase_03 AC 94 ms
76,320 KB
testcase_04 AC 82 ms
73,984 KB
testcase_05 AC 68 ms
68,444 KB
testcase_06 AC 124 ms
76,832 KB
testcase_07 AC 120 ms
76,644 KB
testcase_08 AC 124 ms
76,644 KB
testcase_09 AC 115 ms
76,268 KB
testcase_10 AC 64 ms
68,408 KB
testcase_11 AC 122 ms
76,684 KB
testcase_12 AC 98 ms
76,260 KB
testcase_13 AC 110 ms
76,264 KB
testcase_14 AC 117 ms
76,316 KB
testcase_15 AC 118 ms
76,644 KB
testcase_16 AC 96 ms
76,032 KB
testcase_17 AC 112 ms
76,264 KB
testcase_18 AC 2,889 ms
127,916 KB
testcase_19 AC 317 ms
82,488 KB
testcase_20 TLE -
testcase_21 TLE -
testcase_22 AC 2,083 ms
115,364 KB
testcase_23 AC 1,179 ms
103,804 KB
testcase_24 AC 442 ms
85,092 KB
testcase_25 TLE -
testcase_26 AC 2,639 ms
124,328 KB
testcase_27 AC 2,930 ms
129,164 KB
testcase_28 AC 271 ms
80,712 KB
testcase_29 AC 2,673 ms
126,024 KB
testcase_30 AC 938 ms
94,820 KB
testcase_31 TLE -
testcase_32 AC 510 ms
86,732 KB
testcase_33 AC 843 ms
92,928 KB
testcase_34 TLE -
testcase_35 TLE -
testcase_36 TLE -
testcase_37 AC 1,543 ms
111,468 KB
testcase_38 TLE -
testcase_39 TLE -
testcase_40 TLE -
testcase_41 AC 2,866 ms
128,056 KB
testcase_42 TLE -
testcase_43 AC 2,863 ms
129,928 KB
testcase_44 TLE -
testcase_45 AC 2,491 ms
122,256 KB
testcase_46 AC 1,155 ms
99,208 KB
testcase_47 TLE -
testcase_48 AC 1,886 ms
136,192 KB
testcase_49 TLE -
testcase_50 TLE -
testcase_51 TLE -
testcase_52 TLE -
testcase_53 AC 435 ms
86,620 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<<60

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

heapify(X)
MIN=1<<60

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