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

Автор chokudai, история, 4 года назад, По-английски

We will hold UNIQUE VISION Programming Contest 2022 Summer (AtCoder Beginner Contest 268).

The point values will be 100-200-300-400-500-500-600-600.

We are looking forward to your participation!

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

»
4 года назад, скрыть # |
 
Проголосовать: нравится +34 Проголосовать: не нравится
Problem D >_<
»
4 года назад, скрыть # |
 
Проголосовать: нравится +16 Проголосовать: не нравится

I didn't understand the meaning of problem E all the time !

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

Problem E can be solved with heuristics.

Let f(x) be the sum of frustrations after x rotations, we can notice that f(x) is non-increasing till some point, and non-decreasing after that point.

I did ternary search which passed all except 2 tests, and added some randomization, which got AC.

Here is my ugly code: https://atcoder.jp/contests/abc268/submissions/34747256

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

That problems where basically all like "avoid off-by-one-errors, then you'll be fine", which felt even for abc a little one dimensional.

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

There I go...

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

how to solve c?

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

Can someone tell me what is wrong in my submission for D?

Looks, like my code is not finding solution in some cases, but not sure how it is possible as I am doing all perms + all combination of dashes after it.

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

How to solve F?

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

    Let $$$x$$$ be the number of 'X' characters in a string and $$$d$$$ be the sum of the digit characters in a string. Then sort in order of decreasing $$$x / d$$$ and compute the answer.

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

      Interesting. Thank you! How do we prove such a claim?

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

        I saw it by considering when it’s advantageous to swap adjacent elements and arrived at the above comparator. I recommend this resource for practicing exchange argument style problems: https://mirror.codeforces.com/blog/entry/63533

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

        I proved this with exchange arguments.

        Consider two strings that are adjacent in s, let them be $$$s_1$$$ and $$$s_2$$$.

        Let the number of X in $$$s_1$$$ be $$$d_1$$$, sum of digits in $$$s_1$$$ be $$$x_1$$$. Let the number of X in $$$s_2$$$ be $$$d_2$$$, sum of digits in $$$s_2$$$ be $$$x_2$$$.

        The change in the score when you swap $$$s_1$$$ and $$$s_2$$$ in s will be $$$d_2 x_1 - d_1 x_2$$$.

        If this change is positive, we swap $$$s_1$$$ and $$$s_2$$$.

        So sort in order of decreasing $$$x/d$$$.

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

        Let there be two strings with index $$$i,j$$$.So lets say placing $$$i$$$ before $$$j$$$ gives us a better answer than placing $$$j$$$ before $$$i$$$ so it means that $$$xi{*}dj$$$ $$$ \gt =$$$ $$$xj{*}di$$$ $$$= \gt $$$ $$$xi{/}di$$$ $$$ \gt =$$$ $$$xj{/}dj$$$ as $$$x$$$ and $$$d$$$ are non-negative. Therefore placing $$$i$$$ before $$$j$$$ gives a better answer iff $$$xi{/}di$$$ $$$ \gt =$$$ $$$xj{/}dj$$$. We can extend this idea and just sort the strings in order of decreasing $$$x/d$$$ and compute the answer.

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

Can someone tell me what is wrong with my submission for D?

submission link