結果
| 問題 |
No.1965 Heavier
|
| コンテスト | |
| ユーザー |
ntuda
|
| 提出日時 | 2022-06-25 10:40:59 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 145 ms / 2,000 ms |
| コード長 | 473 bytes |
| コンパイル時間 | 161 ms |
| コンパイル使用メモリ | 82,196 KB |
| 実行使用メモリ | 137,536 KB |
| 最終ジャッジ日時 | 2024-11-14 06:02:48 |
| 合計ジャッジ時間 | 4,828 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 26 |
ソースコード
N = int(input())
A = list(map(int, input().split())) + [0]
B = list(map(int, input().split())) + [0]
ans = 0
for i in range(N + 1):
if i == 0:
nowa = A[i] + B[i]
nowb = A[i] - B[i]
cnt = 1
else:
nexta = A[i] + B[i]
nextb = A[i] - B[i]
if nowa < nexta and nowb < nextb:
cnt += 1
else:
ans += (cnt - 1) * cnt // 2
cnt = 1
nowa = nexta
nowb = nextb
print(ans)
ntuda