結果

問題 No.1965 Heavier
ユーザー ntudantuda
提出日時 2022-06-25 10:32:52
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 511 bytes
コンパイル時間 308 ms
コンパイル使用メモリ 82,008 KB
実行使用メモリ 138,044 KB
最終ジャッジ日時 2024-04-26 16:35:18
合計ジャッジ時間 6,158 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
52,496 KB
testcase_01 AC 36 ms
52,236 KB
testcase_02 AC 36 ms
52,348 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 36 ms
52,156 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 125 ms
112,460 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 140 ms
135,612 KB
testcase_26 AC 134 ms
135,440 KB
testcase_27 AC 138 ms
137,380 KB
testcase_28 AC 141 ms
137,708 KB
権限があれば一括ダウンロードができます

ソースコード

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