Hello everyone ! Let's discuss problems here . How to solve Problems: Find the Radio Operator, Morse Code , WoodCut ?

# | User | Rating |
---|---|---|

1 | tourist | 3803 |

2 | jiangly | 3707 |

3 | Benq | 3627 |

4 | ecnerwala | 3584 |

5 | orzdevinwang | 3573 |

6 | Geothermal | 3569 |

6 | cnnfls_csy | 3569 |

8 | Radewoosh | 3542 |

9 | jqdai0815 | 3532 |

10 | gyh20 | 3447 |

# | User | Contrib. |
---|---|---|

1 | awoo | 163 |

2 | maomao90 | 160 |

3 | adamant | 157 |

4 | maroonrk | 154 |

5 | -is-this-fft- | 150 |

6 | SecondThread | 147 |

6 | atcoder_official | 147 |

6 | Petr | 147 |

9 | nor | 146 |

9 | TheScrasse | 146 |

Hello everyone ! Let's discuss problems here . How to solve Problems: Find the Radio Operator, Morse Code , WoodCut ?

↑

↓

Codeforces (c) Copyright 2010-2024 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Jul/13/2024 02:19:54 (h1).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|

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`

and`f2`

the angles defined in the statement, we observe that both`f1`

and`f2`

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 of`tan(f1)`

(as`R`

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 position`i`

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)), then`dp[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:

8 Text Editor5 Loggers Inc.2 AntiwaistEditorial 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.com/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.