結果
問題 | No.2017 Mod7 Parade |
ユーザー | ああいい |
提出日時 | 2022-07-24 14:58:00 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 782 bytes |
コンパイル時間 | 289 ms |
コンパイル使用メモリ | 87,280 KB |
実行使用メモリ | 87,816 KB |
最終ジャッジ日時 | 2023-09-20 14:15:22 |
合計ジャッジ時間 | 23,645 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 74 ms
76,040 KB |
testcase_01 | AC | 78 ms
71,196 KB |
testcase_02 | AC | 74 ms
71,412 KB |
testcase_03 | TLE | - |
testcase_04 | AC | 1,777 ms
81,676 KB |
testcase_05 | AC | 1,346 ms
81,184 KB |
testcase_06 | TLE | - |
testcase_07 | AC | 448 ms
77,812 KB |
testcase_08 | AC | 1,677 ms
81,660 KB |
testcase_09 | AC | 705 ms
78,344 KB |
testcase_10 | AC | 1,693 ms
81,664 KB |
testcase_11 | TLE | - |
testcase_12 | TLE | - |
testcase_13 | TLE | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
ソースコード
K = int(input()) D = [] L = [] for _ in range(K): d,l = map(int,input().split()) D.append(d) L.append(l) P = 10 ** 9 + 7 inv = pow(9,5,7) dp = [[0] * 7 for _ in range(6)] dp[0][0] = 1 ans = 0 for i in range(K - 1,-1,-1): d,l = D[i],L[i] nx = [[0] * 7 for _ in range(6)] for j in range(6): for k in range(7): tmp = pow(10,j + l,7) - pow(10,j,7) tmp = (tmp * inv * d + k) % 7 ans += tmp * dp[j][k] % P ans %= P nx[j][k] += dp[j][k] nx[(j + l) % 6][tmp] += dp[j][k] for j in range(6): for k in range(7): nx[j][k] %= P #print(ans) dp = nx print(ans) t = 0 for i in range(6): for j in range(7): t += dp[i][j] #print(t)