結果

問題 No.1965 Heavier
ユーザー tassei903tassei903
提出日時 2022-06-03 21:54:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 152 ms / 2,000 ms
コード長 643 bytes
コンパイル時間 174 ms
コンパイル使用メモリ 81,656 KB
実行使用メモリ 145,908 KB
最終ジャッジ日時 2023-10-21 01:49:30
合計ジャッジ時間 4,851 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,280 KB
testcase_01 AC 38 ms
53,280 KB
testcase_02 AC 38 ms
53,280 KB
testcase_03 AC 37 ms
53,280 KB
testcase_04 AC 37 ms
53,280 KB
testcase_05 AC 38 ms
53,280 KB
testcase_06 AC 152 ms
145,128 KB
testcase_07 AC 152 ms
145,152 KB
testcase_08 AC 126 ms
110,584 KB
testcase_09 AC 143 ms
132,044 KB
testcase_10 AC 143 ms
132,044 KB
testcase_11 AC 144 ms
132,040 KB
testcase_12 AC 38 ms
53,280 KB
testcase_13 AC 37 ms
53,280 KB
testcase_14 AC 38 ms
53,280 KB
testcase_15 AC 147 ms
134,356 KB
testcase_16 AC 147 ms
134,364 KB
testcase_17 AC 115 ms
101,068 KB
testcase_18 AC 152 ms
139,420 KB
testcase_19 AC 141 ms
118,148 KB
testcase_20 AC 150 ms
139,488 KB
testcase_21 AC 135 ms
113,292 KB
testcase_22 AC 133 ms
114,024 KB
testcase_23 AC 108 ms
101,772 KB
testcase_24 AC 123 ms
111,808 KB
testcase_25 AC 133 ms
130,624 KB
testcase_26 AC 130 ms
130,028 KB
testcase_27 AC 148 ms
145,908 KB
testcase_28 AC 150 ms
145,896 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda :sys.stdin.readline()[:-1]
ni = lambda :int(input())
na = lambda :list(map(int,input().split()))
yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES")
no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO")
#######################################################################
n = ni()
a = na()
b = na()
c = [0]*(n-1)
for i in range(n-1):
    if abs(b[i]-b[i+1])<a[i+1]-a[i]:
        c[i] = 1

r = []
x = 0
for i in range(n-1):
    if c[i]:
        x += 1
    else:
        r.append(x)
        x = 0
r.append(x)
ans = 0
for i in r:
    ans += i * (i+1)//2
print(ans)
0