結果

問題 No.1965 Heavier
ユーザー ntuda
提出日時 2022-06-25 10:32:52
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 511 bytes
コンパイル時間 196 ms
コンパイル使用メモリ 82,720 KB
実行使用メモリ 137,664 KB
最終ジャッジ日時 2024-11-14 05:52:24
合計ジャッジ時間 6,037 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 6 WA * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int, input().split())) + [0]
B = list(map(int, input().split())) + [0]
ans = 0
flag = 1
for i in range(N + 1):
    if flag == 1:
        nowa = A[i] + B[i]
        nowb = A[i] - B[i]
        flag = 0
        cnt = 1
    else:
        nexta = A[i] + B[i]
        nextb = A[i] - B[i]
        if nowa < nexta and nowb < nextb:
            cnt += 1
            nowa = nexta
            nowb = nextb
        else:
            flag = 1
            ans += (cnt - 1) * cnt // 2
print(ans)
0