結果
問題 | No.1331 Moving Penguin |
ユーザー | chineristAC |
提出日時 | 2020-10-30 17:59:49 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 929 ms / 1,500 ms |
コード長 | 660 bytes |
コンパイル時間 | 294 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 92,288 KB |
最終ジャッジ日時 | 2024-04-25 04:34:12 |
合計ジャッジ時間 | 37,246 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 135 ms
69,376 KB |
testcase_01 | AC | 47 ms
58,624 KB |
testcase_02 | AC | 47 ms
58,624 KB |
testcase_03 | AC | 46 ms
58,496 KB |
testcase_04 | AC | 818 ms
92,160 KB |
testcase_05 | AC | 814 ms
91,264 KB |
testcase_06 | AC | 818 ms
91,264 KB |
testcase_07 | AC | 814 ms
91,520 KB |
testcase_08 | AC | 808 ms
91,008 KB |
testcase_09 | AC | 823 ms
91,008 KB |
testcase_10 | AC | 822 ms
91,136 KB |
testcase_11 | AC | 815 ms
91,008 KB |
testcase_12 | AC | 823 ms
91,008 KB |
testcase_13 | AC | 815 ms
91,008 KB |
testcase_14 | AC | 828 ms
91,136 KB |
testcase_15 | AC | 825 ms
91,008 KB |
testcase_16 | AC | 822 ms
91,008 KB |
testcase_17 | AC | 828 ms
91,008 KB |
testcase_18 | AC | 810 ms
91,008 KB |
testcase_19 | AC | 827 ms
90,880 KB |
testcase_20 | AC | 827 ms
91,136 KB |
testcase_21 | AC | 816 ms
91,008 KB |
testcase_22 | AC | 841 ms
91,008 KB |
testcase_23 | AC | 820 ms
91,136 KB |
testcase_24 | AC | 818 ms
91,008 KB |
testcase_25 | AC | 811 ms
91,008 KB |
testcase_26 | AC | 828 ms
92,160 KB |
testcase_27 | AC | 819 ms
92,032 KB |
testcase_28 | AC | 816 ms
92,160 KB |
testcase_29 | AC | 805 ms
92,288 KB |
testcase_30 | AC | 332 ms
77,568 KB |
testcase_31 | AC | 514 ms
84,224 KB |
testcase_32 | AC | 306 ms
76,032 KB |
testcase_33 | AC | 419 ms
82,048 KB |
testcase_34 | AC | 585 ms
86,784 KB |
testcase_35 | AC | 879 ms
91,776 KB |
testcase_36 | AC | 875 ms
91,648 KB |
testcase_37 | AC | 879 ms
91,648 KB |
testcase_38 | AC | 346 ms
77,824 KB |
testcase_39 | AC | 794 ms
92,160 KB |
testcase_40 | AC | 466 ms
83,584 KB |
testcase_41 | AC | 823 ms
91,648 KB |
testcase_42 | AC | 870 ms
91,776 KB |
testcase_43 | AC | 874 ms
91,648 KB |
testcase_44 | AC | 884 ms
91,648 KB |
testcase_45 | AC | 928 ms
91,648 KB |
testcase_46 | AC | 929 ms
91,392 KB |
testcase_47 | AC | 926 ms
91,520 KB |
testcase_48 | AC | 827 ms
91,008 KB |
ソースコード
N = int(input()) A = list(map(int,input().split())) assert 1<=N<=10**5 assert len(A)==N assert all(1<=A[i]<=N for i in range(N)) A = [0] + A mod = 10**9 + 7 dp = [0 for i in range(N+1)] data = [[0 for i in range(320)] for j in range(320)] dp[-1] = 1 for j in range(1,min(N,320)): data[j][N%j] = 1 for i in range(N-1,0,-1): if A[i]**2 > N: for j in range(A[i],N+1-i,A[i]): dp[i] += dp[i+j] dp[i] %= mod else: dp[i] = data[A[i]][i%A[i]] if A[i]!=1: dp[i] += dp[i+1] dp[i] %= mod for j in range(1,min(320,i)): data[j][i%j] += dp[i] data[j][i%j] %= mod print(dp[1])