結果

問題 No.1965 Heavier
ユーザー rlangevin
提出日時 2022-08-29 12:38:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 143 ms / 2,000 ms
コード長 313 bytes
コンパイル時間 320 ms
コンパイル使用メモリ 81,888 KB
実行使用メモリ 131,364 KB
最終ジャッジ日時 2024-11-06 10:45:44
合計ジャッジ時間 4,927 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

def Gauss(n):
    return n * (n + 1)//2

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
ans, cnt = 0, 0
for i in range(N - 1):
    if A[i + 1] - A[i] > abs(B[i + 1] - B[i]):
        cnt += 1
    else:
        ans += Gauss(cnt)
        cnt = 0
ans += Gauss(cnt)
print(ans)
0