Блог пользователя YF_YUSUF

Автор YF_YUSUF, 3 месяца назад, По-русски

На последнем educational round была задача E что разделена на 2 подзадачи. Решив первую я понял что она по сложности выполнения проходит и вторую подзадачу. Тогда мне стало интересно кто не решил вторую часть и какая у них идея. Посмотрев пару кодов, я понял что идея у них как у меня и отправив 4 из них, 3 получили accept на E2, хотя участники даже не пытались решить E2. еще посмотрев я увидел точно такой же коду этого участника и у еще одного, но забыл у кого именно. Выборка у меня была 200-400 места из таблицы результатов.

Короче я хотел сказать что много серо-зеленых участников отправили E1, но не отправили E2 хотя их решение проходит все тесты на E2.

  • Проголосовать: нравится
  • +15
  • Проголосовать: не нравится

»
3 месяца назад, скрыть # |
 
Проголосовать: нравится +6 Проголосовать: не нравится

В E1 можно попытаться написать перебор за O(log(n)!)

»
3 месяца назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Admins should ban everybody who passed E1, and that didn't send E2, even though they would pass.

»
3 месяца назад, скрыть # |
 
Проголосовать: нравится +5 Проголосовать: не нравится

I agree. It seems like the intended solution is already more or less linear and there's no difficulty in having n=2000 vs n=200k.

If someone found a solution that works for n=2000 but not n=200k I would be really curious to see what it was, or what the writers' reason for splitting the problem in half was

»
3 месяца назад, скрыть # |
Rev. 2  
Проголосовать: нравится +11 Проголосовать: не нравится

One of our testers found a brute-force/dp solution for E which worked for $$$n = 2000$$$, but not for $$$n = 2 \cdot 10^5$$$. He was unable to solve the full version of the problem, and we were afraid of the gap between D and E, so we decided to split the problem into two.

We also were thinking about making a version of E1 which guarantees that the input is consistent with some permutation, but decided it wasn't different enough from the full version.

»
3 месяца назад, скрыть # |
 
Проголосовать: нравится +21 Проголосовать: не нравится

I am 🤡 so wrote a bitmask dp for E1. Let $$$k=\lceil\log_2 (n+1)\rceil$$$. Base idea is to assign strings from higher to lower bits. Note that the string corresponding to the highest bit must have exactly $$$n-2^{k-1}+1$$$ ones. You can show that as long as the answer is nonzero, you can disregard indices with a zero in this string (they will always produce the values $$$1\ldots2^{k-1}-1$$$). From here, I can recurse on a smaller subset of indices with the remaining strings which must produce the values $$$(2^{k-1}+)$$$ $$$0\ldots n-2^{k-1}$$$. So for every subset of strings I've assigned so far I maintain the corresponding subset of indices + values I still need to make + how many permutations are valid.

»
3 месяца назад, скрыть # |
 
Проголосовать: нравится -9 Проголосовать: не нравится

The same happened for me. I solved E1, but not E2 during the contest. Later I found that my solution to E1 was accepted in E2 as well.

  • »
    »
    3 месяца назад, скрыть # ^ |
     
    Проголосовать: нравится +18 Проголосовать: не нравится

    It's very easy to see your submission for E1 has good time complexity to pass the E2. I see no reason why would you not submit E2 if you wrote the code yourself.