結果

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

ソースコード

diff #

from sys import stdin, stderr

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)

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 i < M:
        print(Y[i] - hito)
    else:
        print("infinity")

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