Hello everyone ! Let's discuss problems here . How to solve Problems: Find the Radio Operator, Morse Code , WoodCut ?
№ | Пользователь | Рейтинг |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3831 |
3 | Radewoosh | 3646 |
4 | jqdai0815 | 3620 |
4 | Benq | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | gamegame | 3386 |
10 | ksun48 | 3373 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | cry | 164 |
1 | maomao90 | 164 |
3 | Um_nik | 163 |
4 | atcoder_official | 160 |
5 | -is-this-fft- | 158 |
6 | awoo | 157 |
7 | adamant | 156 |
8 | TheScrasse | 154 |
8 | nor | 154 |
10 | Dominater069 | 153 |
Hello everyone ! Let's discuss problems here . How to solve Problems: Find the Radio Operator, Morse Code , WoodCut ?
Название |
---|
The quality of most problems of GP of Siberia is comparable with GP of Serbia.
Find the radio operator:
Let's make 2 queries from the point (-V, -V) where V > 1000 (we choose V = 5000): one where we point the antenna to right and another one with antenna pointing up.
If we note with
f1
andf2
the angles defined in the statement, we observe that bothf1
andf2
are less than 90 degrees and their sum is exactly 90 degrees. By dividing the two equations that we obtain after reading the values, we find the value oftan(f1)
(asR
is the same for both queries). Now we know that the radio station must be on a line containing the point (-V, -V) and having a known angle.Repeat the process with point (-V, V) and antenna pointing down and to the right and you get another line. The radio station is the intersection of these lines.
Morse code:
Calculate
dp[i]
the minimum number of errors such that the suffix of the signal starting at positioni
represents a valid text formed by words from the dictionary (so there is a word starting at this position).If we fix the first word, we can uniquely identify the position that the next word should start and we can also check if that word can start at position
i
(just check that the groups of '-' and '+' are the same and that the absolute difference between the corresponding ones from the signal and from the word is at most 1). If the check is done in complexity O(len(word)), thendp[i]
can be calculated in complexity O(sum_len(words)).To find the lexicographic smallest answer, pick the lexicographic smallest word (that minimizes the number of errors) at each step.
To ease our implementations, we represented both the words and the signal as vector of pairs (char, count) and written the dynamic directly on this.
thank you cristian1997 !
How to solve in Div1:
Editorial on Russian Language
So, how to do 8 (Text editor) without banging the head against a wall trying to squeeze the solution in both TL and ML?
I'm wondering the same thing (just from the side that was not able to squeeze it in TL)
We encoded the state like:
Then ran dijkstra on top of that graph with transitions computed in $$$O(1)$$$. Overall complexity was $$$O(3 \cdot n! \cdot n^2 \cdot \log(3 \cdot n! \cdot n^2 ))$$$
That was not enough to pass TL.
We had the same solution. We squeezed it in TL by replacing the priority queue in Dijkstra with an array of $$$100\,000$$$ vectors (since we could convince ourselves that the required time should never exceed $$$100\,000$$$). This gets rid of the $$$log(3 \cdot n! \cdot n^2)$$$ factor and is just enough to pass. Of course, you still need to optimize a bunch of other stuff... We had to reimplement the solution from scratch since the first code was just a bit too slow.
Idk, just precalc all transitions and do 0-k bfs instead of dijkstra, works just over 1.5 sec:
Code
I even have $$$O(n! n^{3})$$$ transitions, and to calculate each transition I used $$$O(n)$$$ more, so complexity is $$$O(n! n^{4})$$$
Editorial on Russian language https://codeforces.net/blog/entry/84262 . I guess on Google Translate ,it will be ok.
I did not think O(n^2) would get accepted for #6. I think we can solve single cache in O(n) and unbounded cache in O(nlogn). Did anyone also do so?
Actually, I did implement the O(N^2) DP and it worked in ~0.4s.