結果
問題 |
No.2053 12345...
|
ユーザー |
|
提出日時 | 2022-08-23 17:52:01 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 321 bytes |
コンパイル時間 | 1,123 ms |
コンパイル使用メモリ | 82,464 KB |
実行使用メモリ | 99,904 KB |
最終ジャッジ日時 | 2024-10-11 01:38:54 |
合計ジャッジ時間 | 5,044 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 12 WA * 19 |
ソースコード
from collections import deque n=int(input()) a=list(map(int,input().split())) 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() ans+=len(q)*(len(q)-1)//2 print(ans)