結果

問題 No.1965 Heavier
ユーザー tassei903tassei903
提出日時 2022-06-03 21:46:22
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 640 bytes
コンパイル時間 520 ms
コンパイル使用メモリ 81,424 KB
実行使用メモリ 145,880 KB
最終ジャッジ日時 2023-10-21 01:46:19
合計ジャッジ時間 4,913 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,240 KB
testcase_01 AC 37 ms
53,240 KB
testcase_02 AC 38 ms
53,240 KB
testcase_03 AC 38 ms
53,240 KB
testcase_04 WA -
testcase_05 AC 38 ms
53,240 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 125 ms
110,568 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 133 ms
130,616 KB
testcase_26 AC 131 ms
130,024 KB
testcase_27 AC 148 ms
145,880 KB
testcase_28 AC 149 ms
145,872 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 a[i]+b[i+1] < a[i+1]+b[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