結果

問題 No.2053 12345...
ユーザー DrDrpilotDrDrpilot
提出日時 2022-08-23 18:18:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 121 ms / 2,000 ms
コード長 451 bytes
コンパイル時間 215 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 99,584 KB
最終ジャッジ日時 2024-04-19 09:29:51
合計ジャッジ時間 4,463 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
53,504 KB
testcase_01 AC 49 ms
53,504 KB
testcase_02 AC 53 ms
61,696 KB
testcase_03 AC 67 ms
73,984 KB
testcase_04 AC 100 ms
97,920 KB
testcase_05 AC 67 ms
71,168 KB
testcase_06 AC 97 ms
95,232 KB
testcase_07 AC 90 ms
89,600 KB
testcase_08 AC 87 ms
87,424 KB
testcase_09 AC 102 ms
98,176 KB
testcase_10 AC 116 ms
99,328 KB
testcase_11 AC 66 ms
70,272 KB
testcase_12 AC 70 ms
69,760 KB
testcase_13 AC 121 ms
99,072 KB
testcase_14 AC 79 ms
81,792 KB
testcase_15 AC 78 ms
78,976 KB
testcase_16 AC 77 ms
78,080 KB
testcase_17 AC 72 ms
74,112 KB
testcase_18 AC 121 ms
99,456 KB
testcase_19 AC 92 ms
98,176 KB
testcase_20 AC 60 ms
66,816 KB
testcase_21 AC 91 ms
88,576 KB
testcase_22 AC 50 ms
60,672 KB
testcase_23 AC 58 ms
67,072 KB
testcase_24 AC 63 ms
75,520 KB
testcase_25 AC 107 ms
98,944 KB
testcase_26 AC 78 ms
86,272 KB
testcase_27 AC 68 ms
75,392 KB
testcase_28 AC 59 ms
72,576 KB
testcase_29 AC 85 ms
94,336 KB
testcase_30 AC 59 ms
73,600 KB
testcase_31 AC 83 ms
94,592 KB
testcase_32 AC 114 ms
99,584 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def I():return int(input())
def MAP():return map(int,input().split())
def LIST(): return list(map(int,input().split()))
def S():return input()
from collections import deque
n=I()
a=LIST()
q=deque()
ans=0
for i in a:
    if len(q)==0:
        q.append(i)
        continue
    if q[-1]+1==i:
        q.append(i)
    else:
        ans+=len(q)*(len(q)-1)//2
        while q:
            q.popleft()
        q.append(i)
ans+=len(q)*(len(q)-1)//2
print(ans)
0