結果

問題 No.1965 Heavier
ユーザー SidewaysOwlSidewaysOwl
提出日時 2022-06-03 22:44:52
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 154 ms / 2,000 ms
コード長 298 bytes
コンパイル時間 174 ms
コンパイル使用メモリ 81,624 KB
実行使用メモリ 138,972 KB
最終ジャッジ日時 2023-10-21 02:11:09
合計ジャッジ時間 5,098 ms
ジャッジサーバーID
(参考情報)
judge10 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,436 KB
testcase_01 AC 39 ms
53,436 KB
testcase_02 AC 39 ms
53,436 KB
testcase_03 AC 38 ms
53,436 KB
testcase_04 AC 39 ms
53,436 KB
testcase_05 AC 39 ms
53,436 KB
testcase_06 AC 154 ms
138,188 KB
testcase_07 AC 149 ms
138,208 KB
testcase_08 AC 134 ms
114,084 KB
testcase_09 AC 146 ms
138,472 KB
testcase_10 AC 147 ms
138,480 KB
testcase_11 AC 147 ms
138,480 KB
testcase_12 AC 39 ms
53,436 KB
testcase_13 AC 38 ms
53,436 KB
testcase_14 AC 39 ms
53,436 KB
testcase_15 AC 152 ms
138,028 KB
testcase_16 AC 149 ms
138,036 KB
testcase_17 AC 112 ms
101,812 KB
testcase_18 AC 148 ms
137,936 KB
testcase_19 AC 139 ms
113,488 KB
testcase_20 AC 150 ms
137,924 KB
testcase_21 AC 131 ms
109,164 KB
testcase_22 AC 129 ms
110,000 KB
testcase_23 AC 106 ms
99,824 KB
testcase_24 AC 121 ms
105,144 KB
testcase_25 AC 144 ms
137,284 KB
testcase_26 AC 143 ms
136,692 KB
testcase_27 AC 146 ms
138,972 KB
testcase_28 AC 146 ms
138,960 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = list(map(int,input().split())) + [10**10]
b = list(map(int,input().split())) + [10 ** 20]
cnt = 0
ans = 0
for i in range(1,n+1):
    sa = a[i] - a[i-1]
    if b[i-1] - sa <  b[i] < b[i-1] + sa:
        cnt += 1
    else:
        ans += cnt*(cnt+1)//2
        cnt = 0
print(ans)
0