結果

問題 No.1950 片道きゃっちぼーる
ユーザー MasKoaTSMasKoaTS
提出日時 2022-05-20 23:45:01
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,049 bytes
コンパイル時間 318 ms
コンパイル使用メモリ 81,524 KB
実行使用メモリ 165,572 KB
最終ジャッジ日時 2023-10-20 14:41:31
合計ジャッジ時間 9,340 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
85,504 KB
testcase_01 AC 122 ms
85,476 KB
testcase_02 AC 123 ms
85,504 KB
testcase_03 AC 297 ms
155,948 KB
testcase_04 AC 287 ms
155,756 KB
testcase_05 AC 123 ms
85,500 KB
testcase_06 AC 244 ms
148,352 KB
testcase_07 AC 286 ms
165,572 KB
testcase_08 AC 300 ms
165,316 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 290 ms
165,340 KB
testcase_12 AC 303 ms
165,276 KB
testcase_13 AC 280 ms
150,324 KB
testcase_14 AC 269 ms
149,888 KB
testcase_15 WA -
testcase_16 AC 266 ms
150,052 KB
testcase_17 AC 122 ms
85,504 KB
testcase_18 AC 311 ms
160,220 KB
testcase_19 WA -
testcase_20 AC 292 ms
165,236 KB
testcase_21 AC 285 ms
153,392 KB
testcase_22 AC 280 ms
153,388 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools as iter
import collections as coll
import heapq as hq
import bisect as bis
from decimal import Decimal as dec
from functools import cmp_to_key
import math
import sys
#import pypyjit
#pypyjit.set_param('max_unroll_recursion=-1')
sys.setrecursionlimit(10 ** 6)
inp = sys.stdin.readline
input = lambda : inp().rstrip()
getN = lambda : int(inp())
getNs = lambda : map(int, inp().split())
getList = lambda :list(map(int, inp().split()))
getStrs = lambda n : [input() for _ in [0] * n]
def yexit(): print("Yes"); exit(0)
def nexit(): print("No"); exit(0)
pi = 3.141592653589793
mod = 1000000007
MOD = 998244353
INF = 4611686018427387903
dx = [1, 0, -1, 0];	dy = [0, 1, 0, -1]


"""
Main Code
"""

n = getN()
x = getList()
a = getList()

d = {}
for i, k in enumerate(x):
	d[k] = i

ans = [0] * n
ans[n - 1] = a[n - 1]
for i in range(n - 2, -1, -1):
	ans[i] = a[i]
	y = x[i] + a[i]
	if(y in d):
		ans[i] = ans[d[y]] + a[i]
for i in range(1, n):
	y = x[i] - a[i]
	if(y in d):
		ans[i] = max(ans[i], ans[d[y]] - a[i])
for k in ans:
	print(k)
0