結果

問題 No.1965 Heavier
ユーザー rlangevinrlangevin
提出日時 2022-08-29 12:38:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 148 ms / 2,000 ms
コード長 313 bytes
コンパイル時間 363 ms
コンパイル使用メモリ 82,688 KB
実行使用メモリ 131,424 KB
最終ジャッジ日時 2024-04-24 03:53:41
合計ジャッジ時間 4,751 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
51,968 KB
testcase_01 AC 43 ms
51,712 KB
testcase_02 AC 35 ms
51,840 KB
testcase_03 AC 37 ms
51,840 KB
testcase_04 AC 36 ms
51,840 KB
testcase_05 AC 37 ms
52,224 KB
testcase_06 AC 141 ms
130,576 KB
testcase_07 AC 139 ms
130,692 KB
testcase_08 AC 123 ms
109,476 KB
testcase_09 AC 138 ms
130,904 KB
testcase_10 AC 146 ms
130,884 KB
testcase_11 AC 148 ms
130,912 KB
testcase_12 AC 37 ms
52,096 KB
testcase_13 AC 36 ms
51,968 KB
testcase_14 AC 35 ms
52,224 KB
testcase_15 AC 141 ms
130,524 KB
testcase_16 AC 143 ms
130,504 KB
testcase_17 AC 108 ms
100,224 KB
testcase_18 AC 144 ms
130,856 KB
testcase_19 AC 129 ms
109,260 KB
testcase_20 AC 139 ms
130,316 KB
testcase_21 AC 123 ms
105,412 KB
testcase_22 AC 122 ms
106,636 KB
testcase_23 AC 100 ms
98,688 KB
testcase_24 AC 112 ms
101,648 KB
testcase_25 AC 129 ms
130,008 KB
testcase_26 AC 131 ms
129,112 KB
testcase_27 AC 132 ms
131,424 KB
testcase_28 AC 133 ms
131,288 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def Gauss(n):
    return n * (n + 1)//2

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
ans, cnt = 0, 0
for i in range(N - 1):
    if A[i + 1] - A[i] > abs(B[i + 1] - B[i]):
        cnt += 1
    else:
        ans += Gauss(cnt)
        cnt = 0
ans += Gauss(cnt)
print(ans)
0