Submission #44080113


Source Code Expand

from bisect import bisect_left, bisect_right
NSell, NBuy = list(map(int, input().split(' ')))

# 最低売値
Sell = sorted(list(map(int, input().split(' '))))
# 最高買値
Buy = sorted(list(map(int, input().split(' '))))

# りんごをn円でうってもいい人が、X円で買っても良い人以上

for value in sorted(Sell):
    sellable = bisect_right(Sell, value)
    # 予算value以上の人
    buyable = NBuy - bisect_left(Buy, value)

    # print(value, buyable, sellable)
    if buyable > 0 and buyable <= sellable:
        print(value)
        exit()
# 最安値で売りたい人
if bisect_right(Sell, Sell[0]) < NBuy - bisect_left(Buy, Sell[0]):
    print(Sell[-1] + 1)
    exit()
print(Buy[-1] + 1)  # 0, 0

# 4 4
# 1 100 100 1000000000
# 100 100 100 100

Submission Info

Submission Time
Task C - Invisible Hand
User cocodrips
Language PyPy3 (7.3.0)
Score 0
Code Size 806 Byte
Status WA
Exec Time 276 ms
Memory 115656 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 3
AC × 37
WA × 7
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, random_22.txt, random_23.txt, random_24.txt, random_25.txt, random_26.txt, random_27.txt, random_28.txt, random_29.txt, random_30.txt, random_31.txt, random_32.txt, random_33.txt, random_34.txt, random_35.txt, random_36.txt, random_37.txt, random_38.txt, random_39.txt, random_40.txt, random_41.txt, sample_01.txt, sample_02.txt, sample_03.txt
Case Name Status Exec Time Memory
random_01.txt AC 276 ms 112184 KiB
random_02.txt AC 223 ms 115656 KiB
random_03.txt WA 212 ms 112236 KiB
random_04.txt WA 184 ms 104092 KiB
random_05.txt AC 221 ms 112580 KiB
random_06.txt WA 170 ms 102412 KiB
random_07.txt AC 146 ms 98356 KiB
random_08.txt AC 187 ms 103912 KiB
random_09.txt AC 221 ms 112436 KiB
random_10.txt AC 207 ms 113436 KiB
random_11.txt AC 159 ms 98064 KiB
random_12.txt AC 191 ms 107748 KiB
random_13.txt AC 109 ms 96836 KiB
random_14.txt AC 86 ms 81604 KiB
random_15.txt WA 135 ms 99080 KiB
random_16.txt AC 167 ms 101968 KiB
random_17.txt AC 100 ms 87552 KiB
random_18.txt AC 143 ms 96288 KiB
random_19.txt WA 146 ms 96648 KiB
random_20.txt AC 149 ms 96092 KiB
random_21.txt AC 84 ms 76472 KiB
random_22.txt AC 109 ms 88820 KiB
random_23.txt AC 163 ms 99420 KiB
random_24.txt WA 140 ms 98224 KiB
random_25.txt AC 92 ms 94532 KiB
random_26.txt AC 64 ms 76688 KiB
random_27.txt WA 82 ms 78156 KiB
random_28.txt AC 99 ms 100692 KiB
random_29.txt AC 65 ms 78536 KiB
random_30.txt AC 72 ms 76448 KiB
random_31.txt AC 99 ms 89884 KiB
random_32.txt AC 134 ms 105956 KiB
random_33.txt AC 133 ms 105628 KiB
random_34.txt AC 47 ms 61900 KiB
random_35.txt AC 54 ms 61848 KiB
random_36.txt AC 48 ms 62056 KiB
random_37.txt AC 47 ms 62048 KiB
random_38.txt AC 43 ms 62044 KiB
random_39.txt AC 51 ms 62028 KiB
random_40.txt AC 51 ms 61928 KiB
random_41.txt AC 52 ms 61888 KiB
sample_01.txt AC 54 ms 62020 KiB
sample_02.txt AC 57 ms 61908 KiB
sample_03.txt AC 56 ms 61976 KiB