結果

問題 No.1950 片道きゃっちぼーる
ユーザー ああいいああいい
提出日時 2022-05-20 22:04:33
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 576 bytes
コンパイル時間 226 ms
コンパイル使用メモリ 81,600 KB
実行使用メモリ 170,696 KB
最終ジャッジ日時 2023-10-20 12:44:44
合計ジャッジ時間 10,200 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
53,300 KB
testcase_01 AC 40 ms
53,300 KB
testcase_02 AC 37 ms
53,300 KB
testcase_03 AC 297 ms
170,324 KB
testcase_04 WA -
testcase_05 AC 37 ms
53,304 KB
testcase_06 AC 258 ms
157,780 KB
testcase_07 AC 251 ms
167,580 KB
testcase_08 AC 498 ms
167,844 KB
testcase_09 WA -
testcase_10 AC 351 ms
168,064 KB
testcase_11 AC 282 ms
167,808 KB
testcase_12 AC 289 ms
167,800 KB
testcase_13 AC 358 ms
149,396 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 272 ms
152,564 KB
testcase_17 AC 37 ms
53,304 KB
testcase_18 AC 360 ms
169,640 KB
testcase_19 WA -
testcase_20 AC 266 ms
168,064 KB
testcase_21 WA -
testcase_22 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
X = list(map(int,input().split()))
A = list(map(int,input().split()))

d = dict()
for i,x in enumerate(X):
    d[x] = i
G = [[] for _ in range(N)]
for i in range(N):
    x = X[i]
    a = A[i]
    if x + a in d:
        G[d[x + a]].append(i)
    if x - a in d:
        G[d[x - a]].append(i)
dp = [X[i] + A[i] for i in range(N)]
top = [(X[i],A[i],i) for i in range(N)]
top.sort(key = lambda x:x[0] + x[1],reverse = True)
for x,a,i in top:
    for j in G[i]:
        if dp[i] > dp[j]:
            dp[j] = dp[i]
for i in range(N):
    print(dp[i] - X[i])
       
0