結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 55 ms
63,480 KB
testcase_01 AC 56 ms
63,480 KB
testcase_02 AC 56 ms
63,480 KB
testcase_03 AC 752 ms
145,560 KB
testcase_04 WA -
testcase_05 AC 54 ms
63,484 KB
testcase_06 AC 755 ms
143,348 KB
testcase_07 AC 709 ms
135,152 KB
testcase_08 AC 1,098 ms
134,892 KB
testcase_09 WA -
testcase_10 AC 847 ms
140,228 KB
testcase_11 AC 778 ms
134,680 KB
testcase_12 AC 682 ms
134,676 KB
testcase_13 AC 883 ms
145,008 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 750 ms
143,740 KB
testcase_17 AC 57 ms
63,484 KB
testcase_18 AC 832 ms
144,716 KB
testcase_19 WA -
testcase_20 AC 767 ms
134,672 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 _ in range(5):
    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