結果
| 問題 |
No.1965 Heavier
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-07-02 19:35:19 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 473 ms / 2,000 ms |
| コード長 | 491 bytes |
| コンパイル時間 | 186 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 43,104 KB |
| 最終ジャッジ日時 | 2024-11-27 16:07:11 |
| 合計ジャッジ時間 | 12,249 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 26 |
ソースコード
N = int(input())
A= list(map(int, input().split()))
B = list(map(int, input().split()))
ans=0
C = []
for i in range(N-1):
if A[i]+max(B[i],B[i+1])<A[i+1]+min(B[i],B[i+1]):
C.append(1)
else:
C.append(0)
left=0
#print(C)
while left<=N-2:
count=0
if C[left]==0:
left+=1
continue
for right in range(left,N-1):
if C[right]==1:
count+=1
else:
break
left+=count
ans+=(count+1)*count//2
print(ans)