結果
| 問題 |
No.1965 Heavier
|
| コンテスト | |
| ユーザー |
pitP
|
| 提出日時 | 2022-06-03 23:42:02 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 146 ms / 2,000 ms |
| コード長 | 297 bytes |
| コンパイル時間 | 313 ms |
| コンパイル使用メモリ | 82,224 KB |
| 実行使用メモリ | 131,464 KB |
| 最終ジャッジ日時 | 2024-09-21 03:31:30 |
| 合計ジャッジ時間 | 4,718 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 26 |
ソースコード
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
cnt = 1
ans = 0
for i in range(n-1):
if a[i] + max(b[i],b[i+1]) < a[i+1] + min(b[i],b[i+1]):
cnt += 1
else:
ans += cnt * (cnt-1) //2
cnt = 1
ans += cnt * (cnt-1) //2
print(ans)
pitP