結果

問題 No.1950 片道きゃっちぼーる
ユーザー MasKoaTSMasKoaTS
提出日時 2022-05-20 23:47:43
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,123 bytes
コンパイル時間 158 ms
コンパイル使用メモリ 81,508 KB
実行使用メモリ 165,576 KB
最終ジャッジ日時 2023-10-20 14:43:02
合計ジャッジ時間 12,490 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
85,424 KB
testcase_01 AC 122 ms
85,428 KB
testcase_02 AC 125 ms
85,428 KB
testcase_03 AC 474 ms
155,816 KB
testcase_04 AC 595 ms
155,580 KB
testcase_05 AC 143 ms
85,420 KB
testcase_06 AC 326 ms
148,284 KB
testcase_07 AC 365 ms
165,440 KB
testcase_08 AC 494 ms
165,288 KB
testcase_09 WA -
testcase_10 AC 523 ms
165,120 KB
testcase_11 AC 420 ms
165,116 KB
testcase_12 AC 473 ms
165,576 KB
testcase_13 AC 488 ms
150,560 KB
testcase_14 AC 407 ms
149,876 KB
testcase_15 WA -
testcase_16 AC 348 ms
150,036 KB
testcase_17 AC 126 ms
85,480 KB
testcase_18 AC 587 ms
160,188 KB
testcase_19 WA -
testcase_20 AC 397 ms
165,216 KB
testcase_21 AC 486 ms
153,348 KB
testcase_22 AC 455 ms
153,616 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] * 10:
	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