結果
問題 |
No.1011 Infinite Stairs
|
ユーザー |
![]() |
提出日時 | 2020-03-20 21:46:22 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 676 bytes |
コンパイル時間 | 332 ms |
コンパイル使用メモリ | 82,368 KB |
実行使用メモリ | 154,252 KB |
最終ジャッジ日時 | 2024-12-15 05:13:10 |
合計ジャッジ時間 | 22,936 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 TLE * 3 |
ソースコード
n,d,k=map(int,input().split()) mod=10**9+7 No=2 while No<=k: No*=2 tree=[0]*(2*No) #kをxにする def update(k,x): k+=No-1 tree[k]=x while k>0: k=(k-1)//2 tree[k]=(tree[k*2+1]+tree[k*2+2])%mod #lからrまでの和(l,r含む) def query(l,r): L=l+No-1 R=r+No-1 s=0 while L<=R: if R&1: s+=tree[R] s%=mod R-=2 else: R-=1 if L&1: L-=1 else: s+=tree[L] s%=mod L>>=1;R>>=1 return s%mod update(0,1) for j in range(n): for i in range(k,-1,-1): update(i,query(max(i-d,0),i-1)) print(tree[k+No-1])