| # | User | Rating |
|---|---|---|
| 1 | jiangly | 3810 |
| 2 | Benq | 3676 |
| 3 | Kevin114514 | 3655 |
| 4 | maroonrk | 3463 |
| 5 | strapple | 3447 |
| 6 | Um_nik | 3387 |
| 7 | heuristica | 3322 |
| 8 | turmax | 3317 |
| 9 | tourist | 3307 |
| 10 | jiangbowen | 3291 |
| # | User | Contrib. |
|---|---|---|
| 1 | Qingyu | 156 |
| 2 | nik_exists | 150 |
| 2 | maspy | 150 |
| 4 | Um_nik | 141 |
| 5 | Errichto | 139 |
| 6 | adamant | 137 |
| 7 | AmShZ | 135 |
| 8 | BledDest | 132 |
| 9 | maroonrk | 131 |
| 10 | qwexd | 129 |
|
On
apolyakov →
Knapsack-like problem? Items multiply their values in certain combinations, 10 years ago
0
|
|
On
apolyakov →
Knapsack-like problem? Items multiply their values in certain combinations, 10 years ago
0
Dynamic on Aho-Corasik trie. For each vertex in trie we need to calculate the summary score which it will give(sum of all scores in terminate vertexes which can be reached from vertex). Then dp[n][v] = max score we can receive if we have written n letters staying on vertex v. From each state we can go to 26 other states. O(n*m*k^2) |
|
+4
Interesting problem. Idea: Make 2^N similar Aho-Corasick trie graphs. mask-th graph means that you have already written words from this mask(i-th digit in 2-based numeral system equals 1 if you have written i-th word). You should find a path of least length that connect 0-graph and (2^N-1) graph. You have only 0-weighted(connect graphs) and 1-weighted(connect vertexes) edges. So you can use 0-1 bfs with O(|E|)=O(2^N * |trie| * 26) that should pass tests:) In Aho-Corasick trie you should prohibit all jumps that lead to forbidden words. Also you can solve this problem. P.s. It is a good practice to share a link to your problem. |
|
+4
|
| Name |
|---|


