結果

問題 No.2053 12345...
ユーザー ecotteaecottea
提出日時 2024-02-26 22:40:32
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 170 ms / 2,000 ms
コード長 296 bytes
コンパイル時間 236 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 31,884 KB
最終ジャッジ日時 2024-02-26 22:40:36
合計ジャッジ時間 4,213 ms
ジャッジサーバーID
(参考情報)
judge10 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
9,856 KB
testcase_01 AC 28 ms
9,856 KB
testcase_02 AC 29 ms
10,240 KB
testcase_03 AC 52 ms
14,820 KB
testcase_04 AC 107 ms
24,716 KB
testcase_05 AC 43 ms
13,060 KB
testcase_06 AC 96 ms
23,308 KB
testcase_07 AC 74 ms
19,376 KB
testcase_08 AC 72 ms
18,408 KB
testcase_09 AC 106 ms
24,784 KB
testcase_10 AC 130 ms
30,600 KB
testcase_11 AC 42 ms
12,872 KB
testcase_12 AC 39 ms
11,392 KB
testcase_13 AC 154 ms
29,600 KB
testcase_14 AC 75 ms
15,880 KB
testcase_15 AC 60 ms
15,216 KB
testcase_16 AC 61 ms
14,844 KB
testcase_17 AC 53 ms
13,332 KB
testcase_18 AC 170 ms
31,524 KB
testcase_19 AC 114 ms
25,492 KB
testcase_20 AC 37 ms
11,264 KB
testcase_21 AC 96 ms
19,080 KB
testcase_22 AC 28 ms
10,112 KB
testcase_23 AC 39 ms
12,160 KB
testcase_24 AC 56 ms
15,432 KB
testcase_25 AC 124 ms
29,620 KB
testcase_26 AC 75 ms
19,232 KB
testcase_27 AC 54 ms
15,440 KB
testcase_28 AC 48 ms
14,188 KB
testcase_29 AC 93 ms
22,624 KB
testcase_30 AC 53 ms
14,696 KB
testcase_31 AC 90 ms
22,184 KB
testcase_32 AC 142 ms
31,884 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = list(map(int, input().split()))

for i in range(n):
    a[i] -= i
a.append(12345678987654321)

res = 0

p = -1
l = -1
for i in range(n + 1):
    if a[i] == p:
        None
    else:
        w = i - l
        res += w * (w - 1) // 2
        p = a[i]
        l = i

print(res)
0