結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
85,428 KB
testcase_01 AC 124 ms
85,424 KB
testcase_02 AC 127 ms
85,428 KB
testcase_03 AC 343 ms
155,804 KB
testcase_04 AC 387 ms
155,932 KB
testcase_05 AC 122 ms
85,424 KB
testcase_06 AC 273 ms
148,272 KB
testcase_07 AC 315 ms
165,464 KB
testcase_08 AC 359 ms
165,336 KB
testcase_09 WA -
testcase_10 AC 379 ms
165,116 KB
testcase_11 AC 329 ms
165,256 KB
testcase_12 AC 364 ms
165,552 KB
testcase_13 AC 349 ms
150,224 KB
testcase_14 AC 318 ms
149,828 KB
testcase_15 WA -
testcase_16 AC 294 ms
149,988 KB
testcase_17 AC 122 ms
85,424 KB
testcase_18 AC 418 ms
160,144 KB
testcase_19 WA -
testcase_20 AC 325 ms
165,168 KB
testcase_21 AC 354 ms
153,564 KB
testcase_22 AC 348 ms
153,252 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

for _ in [0] * 4:
	ans[n - 1] = max(ans[n - 1], a[n - 1])
	for i in range(n - 2, -1, -1):
		ans[i] = max(ans[i], a[i])
		y = x[i] + a[i]
		if(y in d):
			ans[i] = max(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