結果

問題 No.1965 Heavier
ユーザー buey_tbuey_t
提出日時 2023-08-08 22:12:29
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,360 bytes
コンパイル時間 281 ms
コンパイル使用メモリ 82,044 KB
実行使用メモリ 132,360 KB
最終ジャッジ日時 2024-04-26 14:20:47
合計ジャッジ時間 8,057 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
84,908 KB
testcase_01 AC 118 ms
85,196 KB
testcase_02 AC 117 ms
85,192 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 118 ms
85,212 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 245 ms
131,248 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 239 ms
129,348 KB
testcase_26 AC 239 ms
128,180 KB
testcase_27 AC 237 ms
127,948 KB
testcase_28 AC 232 ms
127,924 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import sqrt,sin,cos,tan,ceil,radians,floor,gcd,exp,log,log10,log2,factorial,fsum
from heapq import heapify, heappop, heappush
from bisect import bisect_left, bisect_right
from copy import deepcopy
import copy
import random
from random import randrange
from collections import deque,Counter,defaultdict
from itertools import permutations,combinations
from decimal import Decimal,ROUND_HALF_UP
#tmp = Decimal(mid).quantize(Decimal('0'), rounding=ROUND_HALF_UP)
from functools import lru_cache, reduce
#@lru_cache(maxsize=None)
from operator import add,sub,mul,xor,and_,or_,itemgetter
import sys
#input = sys.stdin.readline
# .rstrip()
INF = 10**18
mod1 = 10**9+7
mod2 = 998244353

#DecimalならPython
#再帰ならPython!!!!!!!!!!!!!!!!!!!!!!!!!!


'''
Bi < Bj
交換した結果、逆転するといくない
荷物が重いといくない
今までの区間で一番大きい値を持っておく
荷物が軽いほうが良い
体重は重いほうがよくて、荷物は軽いほうがいい
体重-荷物がでかいやつ
二分探索が必要か?
単調増加

2 4 5 8
2 1 6 2

[1,2],[3,4]

'''

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

ls = []

ans = 0

for i in range(N):
    f = bisect_left(ls,A[i]-B[i])
    
    ans += f
    
    ls.append(A[i]-B[i])

print(ans)


























0