結果

問題 No.1950 片道きゃっちぼーる
ユーザー pitP
提出日時 2022-05-20 23:26:14
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 402 bytes
コンパイル時間 328 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 191,656 KB
最終ジャッジ日時 2024-09-20 09:52:35
合計ジャッジ時間 11,172 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 16 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict


n = int(input())
x = list(map(int,input().split()))
a = list(map(int,input().split()))
d = defaultdict(int)
hq = []

for i in range(n):
    d[x[i]] = a[i]
    hq.append([-x[i]-a[i] , i])

ans = [0] * n
hq.sort()

for j in range(n):
    dist,i = hq[j]
    ans[i] = max(a[i] , d[x[i] + a[i]] + a[i] , d[x[i] - a[i]] - a[i])
    d[x[i]] = ans[i]

print(*ans,sep="\n")
0