結果
問題 |
No.1950 片道きゃっちぼーる
|
ユーザー |
![]() |
提出日時 | 2022-05-20 22:58:34 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 435 bytes |
コンパイル時間 | 196 ms |
コンパイル使用メモリ | 82,072 KB |
実行使用メモリ | 210,720 KB |
最終ジャッジ日時 | 2024-09-20 09:21:26 |
合計ジャッジ時間 | 20,871 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 16 WA * 7 |
ソースコード
from collections import defaultdict import heapq 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] heapq.heappush(hq,[-x[i]-a[i] , i]) ans = [0] * n while hq: _,idx = heapq.heappop(hq) ans[idx] = max(a[idx] , d[x[idx] + a[idx]] + a[idx] , d[x[idx] - a[idx]] - a[idx]) d[x[idx]] = ans[idx] print(*ans,sep="\n")