結果
問題 |
No.2053 12345...
|
ユーザー |
|
提出日時 | 2022-08-23 17:46:17 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 512 bytes |
コンパイル時間 | 363 ms |
コンパイル使用メモリ | 82,560 KB |
実行使用メモリ | 82,944 KB |
最終ジャッジ日時 | 2024-10-11 01:34:15 |
合計ジャッジ時間 | 4,987 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 1 TLE * 1 -- * 29 |
ソースコード
from itertools import accumulate n=int(input()) a=list(map(int,input().split())) f=[0]*n for i in range(1,n): if a[i]-a[i-1]==1: f[i]=1 f=[0]+f F=list(accumulate(f)) #print(f) ans=0 for size in range(2,n+1): #print('今のサイズ'+str(size)) for i in range(n+1-size): cnt=F[i+size]-F[i] #print(cnt) if cnt==size: ans+=1 elif cnt==size-1 and f[i+1]==0: ans+=1 else: pass #print('ansは'+str(ans)) print(ans)