結果

問題 No.1950 片道きゃっちぼーる
ユーザー pitPpitP
提出日時 2022-05-20 23:26:14
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 402 bytes
コンパイル時間 204 ms
コンパイル使用メモリ 81,832 KB
実行使用メモリ 191,220 KB
最終ジャッジ日時 2023-10-20 14:22:49
合計ジャッジ時間 11,862 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
53,512 KB
testcase_01 AC 40 ms
53,512 KB
testcase_02 AC 39 ms
53,512 KB
testcase_03 AC 331 ms
168,356 KB
testcase_04 WA -
testcase_05 AC 41 ms
53,512 KB
testcase_06 AC 248 ms
149,924 KB
testcase_07 AC 303 ms
187,140 KB
testcase_08 AC 1,019 ms
191,220 KB
testcase_09 WA -
testcase_10 AC 512 ms
162,532 KB
testcase_11 AC 337 ms
165,112 KB
testcase_12 AC 341 ms
165,660 KB
testcase_13 AC 452 ms
155,496 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 240 ms
139,280 KB
testcase_17 AC 40 ms
53,516 KB
testcase_18 AC 528 ms
182,636 KB
testcase_19 WA -
testcase_20 AC 325 ms
165,116 KB
testcase_21 WA -
testcase_22 WA -
権限があれば一括ダウンロードができます

ソースコード

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