結果
| 問題 | No.1965 Heavier |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-07-02 19:35:19 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
AC
|
| 実行時間 | 307 ms / 2,000 ms |
| コード長 | 491 bytes |
| 記録 | |
| コンパイル時間 | 956 ms |
| コンパイル使用メモリ | 20,824 KB |
| 実行使用メモリ | 45,996 KB |
| 最終ジャッジ日時 | 2026-05-21 22:01:20 |
| 合計ジャッジ時間 | 11,763 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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)