結果

問題 No.1950 片道きゃっちぼーる
ユーザー siganaisiganai
提出日時 2022-05-20 23:21:50
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 794 bytes
コンパイル時間 277 ms
コンパイル使用メモリ 81,748 KB
実行使用メモリ 146,224 KB
最終ジャッジ日時 2023-10-20 14:13:36
合計ジャッジ時間 10,046 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 55 ms
63,616 KB
testcase_01 AC 56 ms
63,616 KB
testcase_02 AC 55 ms
63,616 KB
testcase_03 AC 331 ms
145,704 KB
testcase_04 WA -
testcase_05 AC 53 ms
63,616 KB
testcase_06 AC 319 ms
143,472 KB
testcase_07 AC 305 ms
135,280 KB
testcase_08 AC 536 ms
135,020 KB
testcase_09 WA -
testcase_10 AC 395 ms
140,356 KB
testcase_11 AC 321 ms
134,820 KB
testcase_12 AC 306 ms
134,812 KB
testcase_13 AC 429 ms
145,136 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 325 ms
143,868 KB
testcase_17 AC 56 ms
63,616 KB
testcase_18 AC 396 ms
144,848 KB
testcase_19 WA -
testcase_20 AC 321 ms
140,356 KB
testcase_21 WA -
testcase_22 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env PyPy3

from collections import Counter, defaultdict, deque
import itertools
import re
import math
from functools import reduce
import operator
import bisect
from heapq import *
import functools

mod=998244353

import sys
input=sys.stdin.readline
n=int(input())
x=list(map(int,input().split()))
a=list(map(int,input().split()))
p = [i for i in range(n)]
p.sort(key = lambda y:x[y]+a[y],reverse = True)
ans = [-1] * n
for pp in p:
    ans[pp] = x[pp] + a[pp]
    idx = bisect.bisect_right(x,x[pp] + a[pp])
    if x[idx-1] == x[pp] + a[pp]:
        ans[pp] = max(ans[pp],ans[idx-1])
    idx = bisect.bisect_right(x,x[pp] - a[pp])
    if idx == 0:
        continue
    if x[idx-1] == x[pp] - a[pp]:
        ans[pp] = max(ans[pp],ans[idx-1])
for i in range(n):
    print(ans[i]-x[i])
0