結果

問題 No.2248 max(C)-min(C)
ユーザー titiatitia
提出日時 2023-03-17 21:59:30
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 544 bytes
コンパイル時間 265 ms
コンパイル使用メモリ 11,968 KB
実行使用メモリ 50,392 KB
最終ジャッジ日時 2023-10-18 14:39:37
合計ジャッジ時間 23,929 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,164 KB
testcase_01 AC 28 ms
10,164 KB
testcase_02 AC 29 ms
10,164 KB
testcase_03 AC 37 ms
10,332 KB
testcase_04 AC 35 ms
10,280 KB
testcase_05 AC 32 ms
10,240 KB
testcase_06 AC 46 ms
10,512 KB
testcase_07 AC 48 ms
10,588 KB
testcase_08 AC 49 ms
10,592 KB
testcase_09 AC 48 ms
10,596 KB
testcase_10 AC 33 ms
10,236 KB
testcase_11 AC 48 ms
10,596 KB
testcase_12 AC 37 ms
10,352 KB
testcase_13 AC 42 ms
10,444 KB
testcase_14 AC 48 ms
10,592 KB
testcase_15 AC 48 ms
10,596 KB
testcase_16 AC 38 ms
10,332 KB
testcase_17 AC 47 ms
10,548 KB
testcase_18 AC 2,692 ms
46,472 KB
testcase_19 AC 266 ms
14,676 KB
testcase_20 TLE -
testcase_21 AC 2,969 ms
48,548 KB
testcase_22 AC 2,013 ms
36,968 KB
testcase_23 AC 1,167 ms
27,200 KB
testcase_24 AC 416 ms
16,784 KB
testcase_25 AC 2,893 ms
46,908 KB
testcase_26 AC 2,662 ms
42,752 KB
testcase_27 TLE -
testcase_28 AC 237 ms
13,800 KB
testcase_29 AC 2,814 ms
43,880 KB
testcase_30 AC 1,014 ms
23,728 KB
testcase_31 TLE -
testcase_32 AC 531 ms
17,904 KB
testcase_33 AC 901 ms
22,584 KB
testcase_34 TLE -
testcase_35 TLE -
testcase_36 TLE -
testcase_37 AC 1,619 ms
31,220 KB
testcase_38 TLE -
testcase_39 TLE -
testcase_40 TLE -
testcase_41 AC 2,836 ms
45,644 KB
testcase_42 TLE -
testcase_43 AC 2,953 ms
46,804 KB
testcase_44 TLE -
testcase_45 AC 2,569 ms
42,524 KB
testcase_46 AC 1,204 ms
27,200 KB
testcase_47 TLE -
testcase_48 AC 2,247 ms
47,148 KB
testcase_49 TLE -
testcase_50 TLE -
testcase_51 TLE -
testcase_52 TLE -
testcase_53 -- -
権限があれば一括ダウンロードができます

ソースコード

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