結果

問題 No.1331 Moving Penguin
ユーザー persimmon-persimmonpersimmon-persimmon
提出日時 2021-02-14 09:26:58
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 726 bytes
コンパイル時間 286 ms
コンパイル使用メモリ 87,428 KB
実行使用メモリ 92,860 KB
最終ジャッジ日時 2023-09-28 20:17:30
合計ジャッジ時間 55,436 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 110 ms
77,016 KB
testcase_01 AC 75 ms
71,904 KB
testcase_02 AC 75 ms
71,896 KB
testcase_03 AC 76 ms
71,768 KB
testcase_04 AC 1,220 ms
92,264 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 1,234 ms
91,328 KB
testcase_11 WA -
testcase_12 AC 1,235 ms
91,448 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 1,236 ms
91,396 KB
testcase_21 AC 1,230 ms
91,252 KB
testcase_22 AC 1,231 ms
91,424 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 1,225 ms
92,524 KB
testcase_27 AC 1,227 ms
92,712 KB
testcase_28 AC 1,227 ms
92,616 KB
testcase_29 AC 1,212 ms
92,860 KB
testcase_30 AC 305 ms
80,456 KB
testcase_31 AC 589 ms
84,372 KB
testcase_32 AC 262 ms
79,316 KB
testcase_33 AC 427 ms
81,804 KB
testcase_34 AC 732 ms
87,168 KB
testcase_35 AC 1,377 ms
92,032 KB
testcase_36 AC 1,366 ms
91,932 KB
testcase_37 WA -
testcase_38 AC 321 ms
80,636 KB
testcase_39 AC 1,170 ms
92,416 KB
testcase_40 AC 498 ms
83,668 KB
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 AC 1,364 ms
92,152 KB
testcase_45 AC 1,464 ms
92,212 KB
testcase_46 AC 1,476 ms
91,820 KB
testcase_47 TLE -
testcase_48 AC 1,225 ms
91,092 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main1(n,a):
  dp=[0]*n
  mod=10**9+7
  dp[0]=1
  base=0
  c=int(n**0.5)+1
  ary=[[0]*c for _ in range(c)]
  for i in range(n):
    # マスiに到達するケースを加算
    for j in range(1,min(i,c)):
      dp[i]+=ary[j][i%j]
      dp[i]%=mod
    dp[i]+=base
    dp[i]%=mod
    if i==n-1:break
    k=a[i]
    if k==1:
      base+=dp[i]
      base%=mod
    elif k<c:
      dp[i+1]+=dp[i]
      dp[i+1]%=mod
      ary[k][i%k]+=dp[i]
      ary[k][i%k]%=mod
    else:
      dp[i+1]+=dp[i]
      dp[i+1]%=mod
      ii=i+k
      while ii<n:
        dp[ii]+=dp[i]
        dp[ii]%=mod
        ii+=k
  return dp[-1]

if __name__=='__main__':
  n=int(input())
  a=list(map(int,input().split()))
  ret1=main1(n,a)
  print(ret1)
0