"16. 24.04.2016 11:00 Grand Prix of South Caucasus" 11:20 and contest still not opened :(
# | User | Rating |
---|---|---|
1 | tourist | 3985 |
2 | jiangly | 3814 |
3 | jqdai0815 | 3682 |
4 | Benq | 3529 |
5 | orzdevinwang | 3526 |
6 | ksun48 | 3517 |
7 | Radewoosh | 3410 |
8 | hos.lyric | 3399 |
9 | ecnerwala | 3392 |
9 | Um_nik | 3392 |
# | User | Contrib. |
---|---|---|
1 | cry | 169 |
2 | maomao90 | 162 |
2 | Um_nik | 162 |
4 | atcoder_official | 161 |
5 | djm03178 | 158 |
6 | -is-this-fft- | 157 |
7 | adamant | 155 |
8 | awoo | 154 |
8 | Dominater069 | 154 |
10 | luogu_official | 150 |
Name |
---|
How to solve C? We had AC with solution in O(Ans·n·m) but it doesn't seem to be a good complexity.
How to solve it with such complexity?
Build prefix-function automaton for string m. Then for each state and each initial keyword find the state when you will be after feeding to it strings α, h(α), h(h(α)) and so on. Then check each time if hk(1) from initial state leads you to the terminal state.
Nevermind, this solution is wrong.
Did you have this solution accepted? The second statement about logn steps seems to be wrong:
Here, the target string is being made directly of 1 (and you can't go deeper), and you need about 500 steps to reach the target.
Anyway, the answer could be O(n2). This is a tight bound: there is a proof on the upper bound, and a testcase could be constructed. In the testcase above you've fixed the left side of the target string and had to make N-2 moves to reach the right side. Now make the similar construction on the both sides: you'll reach the left part every P-th move, and the right part every Q-th move (P+Q = N-1). Thus the answer is LCM(P, Q) + O(1).
How to solve problem H ? I have solved it from the dual problem of the linear optimization but I am not shure I can prove that my integer solution is optimal. Answers in russian are acceptable