結果

問題 No.1722 [Cherry 3rd Tune C] In my way
ユーザー vwxyz
提出日時 2022-09-06 16:51:01
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 35 ms / 2,000 ms
コード長 670 bytes
コンパイル時間 115 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,136 KB
最終ジャッジ日時 2024-11-21 17:57:32
合計ジャッジ時間 1,793 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
readline=sys.stdin.readline
write=sys.stdout.write

def Compress(lst):
    decomp=sorted(list(set(lst)))
    comp={x:i for i,x in enumerate(decomp)}
    return comp,decomp

N,M=map(int,readline().split())
X=list(map(int,readline().split()))
Y=list(map(int,readline().split()))
inf=1<<60
comp,decomp=Compress(X+Y+[inf])
for i in range(N):
    X[i]=comp[X[i]]
for i in range(M):
    Y[i]=comp[Y[i]]
XY=[None]*(N+M)
for i in range(N):
    XY[X[i]]="X"
for i in range(M):
    XY[Y[i]]="Y"
XY.append("Y")
for i in range(N):
    cur=X[i]
    while XY[cur]=="X":
        cur+=1
    ans=decomp[cur]-decomp[X[i]]
    if ans>1<<50:
        ans="Infinity"
    print(ans)
0