結果

問題 No.2248 max(C)-min(C)
ユーザー ああいいああいい
提出日時 2023-03-18 20:32:17
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 819 bytes
コンパイル時間 245 ms
コンパイル使用メモリ 81,852 KB
実行使用メモリ 140,356 KB
最終ジャッジ日時 2023-10-18 17:33:16
合計ジャッジ時間 53,643 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,568 KB
testcase_01 AC 36 ms
53,568 KB
testcase_02 AC 37 ms
53,568 KB
testcase_03 AC 55 ms
68,480 KB
testcase_04 AC 52 ms
66,404 KB
testcase_05 AC 45 ms
61,748 KB
testcase_06 AC 62 ms
72,660 KB
testcase_07 AC 68 ms
75,912 KB
testcase_08 AC 67 ms
75,908 KB
testcase_09 AC 67 ms
75,908 KB
testcase_10 AC 46 ms
61,748 KB
testcase_11 AC 68 ms
75,908 KB
testcase_12 AC 55 ms
68,480 KB
testcase_13 AC 60 ms
72,660 KB
testcase_14 AC 69 ms
76,056 KB
testcase_15 AC 70 ms
76,080 KB
testcase_16 AC 56 ms
68,480 KB
testcase_17 AC 66 ms
74,232 KB
testcase_18 AC 1,688 ms
123,516 KB
testcase_19 AC 217 ms
82,860 KB
testcase_20 AC 1,958 ms
140,220 KB
testcase_21 AC 1,854 ms
120,276 KB
testcase_22 AC 1,267 ms
119,660 KB
testcase_23 AC 793 ms
99,284 KB
testcase_24 AC 313 ms
87,436 KB
testcase_25 AC 1,776 ms
117,304 KB
testcase_26 AC 1,546 ms
122,232 KB
testcase_27 AC 1,732 ms
117,752 KB
testcase_28 AC 178 ms
80,372 KB
testcase_29 AC 1,599 ms
124,916 KB
testcase_30 AC 618 ms
95,976 KB
testcase_31 AC 1,946 ms
140,220 KB
testcase_32 WA -
testcase_33 AC 567 ms
94,460 KB
testcase_34 AC 1,970 ms
140,356 KB
testcase_35 AC 1,953 ms
140,220 KB
testcase_36 AC 1,955 ms
139,704 KB
testcase_37 AC 972 ms
110,112 KB
testcase_38 AC 1,899 ms
129,808 KB
testcase_39 AC 1,881 ms
129,800 KB
testcase_40 AC 1,863 ms
129,832 KB
testcase_41 AC 1,566 ms
131,896 KB
testcase_42 WA -
testcase_43 AC 1,655 ms
126,396 KB
testcase_44 AC 1,880 ms
129,536 KB
testcase_45 WA -
testcase_46 AC 724 ms
101,388 KB
testcase_47 WA -
testcase_48 AC 326 ms
130,080 KB
testcase_49 AC 1,755 ms
139,492 KB
testcase_50 AC 1,746 ms
139,488 KB
testcase_51 AC 1,768 ms
139,488 KB
testcase_52 AC 1,758 ms
139,492 KB
testcase_53 AC 282 ms
87,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

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

l = [(A[i],i) for i in range(N)] + [(B[i],i) for i in range(N)] + [(A[i] // 2 + B[i] // 2,i) for i in range(N)]
l.sort()

now = l[0][0]
ii = l[0][1]

ans = 10 ** 10
inf = 10 ** 11
t = 0
for i in range(N):
    a = A[i]
    b = B[i]
    c = (a + b) // 2
    k = inf
    for u in (a,b,c):
        if u >= now and u < k:
            k = u
    if k > t:
        t = k
ans = t - now
for n,jj in l[1:]:
    a = A[ii]
    b = B[ii]
    c = (a + b) // 2
    k = inf
    for u in (a,b,c):
        if u >= n and u < k:
            k = u
    """
    if k == inf:
        print(ans)
        exit()
    """
    if k > t:
        t = k
    if ii == jj:pass
    elif t - n < ans:
        ans = t - n
    now = n
    ii = jj
print(ans)
0