結果

問題 No.1965 Heavier
ユーザー sotanishysotanishy
提出日時 2022-06-03 21:36:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 143 ms / 2,000 ms
コード長 337 bytes
コンパイル時間 167 ms
コンパイル使用メモリ 81,652 KB
実行使用メモリ 132,100 KB
最終ジャッジ日時 2023-10-21 01:40:45
合計ジャッジ時間 4,700 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
53,352 KB
testcase_01 AC 37 ms
53,352 KB
testcase_02 AC 38 ms
53,352 KB
testcase_03 AC 37 ms
53,352 KB
testcase_04 AC 37 ms
53,352 KB
testcase_05 AC 39 ms
53,352 KB
testcase_06 AC 140 ms
131,692 KB
testcase_07 AC 143 ms
131,708 KB
testcase_08 AC 123 ms
110,684 KB
testcase_09 AC 142 ms
131,884 KB
testcase_10 AC 139 ms
131,892 KB
testcase_11 AC 137 ms
131,896 KB
testcase_12 AC 37 ms
53,352 KB
testcase_13 AC 37 ms
53,352 KB
testcase_14 AC 37 ms
53,352 KB
testcase_15 AC 137 ms
131,516 KB
testcase_16 AC 138 ms
131,520 KB
testcase_17 AC 105 ms
98,248 KB
testcase_18 AC 142 ms
131,508 KB
testcase_19 AC 129 ms
110,244 KB
testcase_20 AC 139 ms
131,516 KB
testcase_21 AC 122 ms
106,312 KB
testcase_22 AC 121 ms
107,028 KB
testcase_23 AC 99 ms
95,668 KB
testcase_24 AC 112 ms
102,420 KB
testcase_25 AC 131 ms
130,968 KB
testcase_26 AC 131 ms
130,584 KB
testcase_27 AC 135 ms
132,100 KB
testcase_28 AC 135 ms
132,088 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
p = [A[i] + B[i] for i in range(N)]
m = [A[i] - B[i] for i in range(N)]
ans = 0
l = 0
for r in range(1, N):
    if p[r-1] >= p[r]:
        l = r
    if m[r-1] >= m[r]:
        l = r
    ans += r - l
print(ans)
0