結果

問題 No.1722 [Cherry 3rd Tune C] In my way
ユーザー nariyel
提出日時 2021-10-29 22:37:45
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 605 bytes
コンパイル時間 339 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-10-07 12:16:59
合計ジャッジ時間 1,904 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 15 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

from sys import stdin

N, M = map(int, stdin.readline().split())
X = list(map(int, stdin.readline().split()))
Y = list(map(int, stdin.readline().split()))
Y.sort()
ymax = max(Y)
#print(Y)

def bintan(liste, cle):
    d = len(liste)
    g = -1

    while d - g > 1:
        moy = g + (d - g) // 2
        if liste[moy] >= cle:
            d = moy
        else:
            g = moy
    return d

for hito in X:
    i = bintan(Y, hito)
    if hito >= ymax:
        print("infinity")
    elif i >= M:
        print("infinity")
        #i -= 1
        #print(Y[i] - hito)
    else:
        print(Y[i] - hito)

0