結果
問題 | No.1950 片道きゃっちぼーる |
ユーザー | pitP |
提出日時 | 2022-05-20 22:58:34 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 435 bytes |
コンパイル時間 | 149 ms |
コンパイル使用メモリ | 81,840 KB |
実行使用メモリ | 210,252 KB |
最終ジャッジ日時 | 2023-10-20 13:50:58 |
合計ジャッジ時間 | 23,975 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 48 ms
55,524 KB |
testcase_01 | AC | 47 ms
55,524 KB |
testcase_02 | AC | 45 ms
55,524 KB |
testcase_03 | AC | 1,214 ms
188,740 KB |
testcase_04 | WA | - |
testcase_05 | AC | 45 ms
55,548 KB |
testcase_06 | AC | 1,011 ms
147,064 KB |
testcase_07 | AC | 1,105 ms
210,252 KB |
testcase_08 | AC | 1,585 ms
201,532 KB |
testcase_09 | WA | - |
testcase_10 | AC | 1,240 ms
184,556 KB |
testcase_11 | AC | 1,013 ms
170,000 KB |
testcase_12 | AC | 1,129 ms
183,456 KB |
testcase_13 | AC | 980 ms
162,308 KB |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | AC | 1,047 ms
146,132 KB |
testcase_17 | AC | 44 ms
55,548 KB |
testcase_18 | AC | 1,244 ms
199,472 KB |
testcase_19 | WA | - |
testcase_20 | AC | 1,025 ms
170,208 KB |
testcase_21 | WA | - |
testcase_22 | WA | - |
ソースコード
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")