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

Автор xug, 3 месяца назад, По-английски

The TeamsCode Summer 2024 Virtual Programming Contest was held on Sunday, July 28. The problems were written and prepared by Yam, hyforces, oursaco, willy108, jay_jayjay, HaccerKat, xug, yash_9a3b, Red0, and superhelen. The problems (with problem credits) can be found in the Novice Gym and Advanced Gym. lunchbox solved all the problems during testing and provided valuable feedback.

Novice A / Advanced A: P!=NP

Hint
Solution
Code (C++)
Code (Python)

Novice B: Ifrit Tile 2

Solution
Code

Novice C: Phonier

Hint
Solution
Code (C++)
Code (Python)

Novice D: Parallel Arrays

Hint 1
Hint 2
Solution
Code (C++)
Code (Python)

Novice E: Minimize Sum

Hint 1
Hint 2
Solution
Code (C++)
Code (Python)

Novice F: XOR Game

Hint 1
Hint 2
Hint 3
Solution
Code

Novice G / Advanced B: Monkey Arrays

Hint
Solution
Code

Novice H: Digit Removal

Hint 1
Hint 2
Solution
Code

Novice I / Advanced C: Monkey Math Tree

Hint 1
Hint 2
Solution
Code

Novice J / Advanced D: Kawaii the Rinbot

Hint 1
Hint 2
Hint 3
Solution

Novice K / Advanced E: Waymo orzorzorz

Hint 1
Hint 2
Hint 3
Solution
Code

Advanced F: Stage 4

Hint 1
Hint 2
Solution
Code

Advanced G: Ifrit Tile

Solution
Code

Advanced H: Thomas Sometimes Hides His Feelings in C++

Hint 1
Hint 2
Hint 3
Hint 4
Hint 5
Solution
Code

Advanced I: Flappy Deer

Hint 1
Hint 2
Hint 3
Hint 4
Solution
Code

Advanced J: Grid Product

Hint 1
Hint 2
Hint 3
Hint 4
Solution
Code

Advanced K: The Astral Express

Hint 1
Hint 2
Hint 3
Solution
Code
Alternative Solution
Problem History
Разбор задач TeamsCode Summer 2024 Novice Division
Разбор задач TeamsCode Summer 2024 Advanced Division
  • Проголосовать: нравится
  • +24
  • Проголосовать: не нравится

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

Problems great, W contest, wish I had 2 more minutes of time :/

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

bruh two treap problems

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

Problem history for Advanced K has 2 LGM and 1 expert, but that expert has the name of rainboy

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

I am finding it difficult to understand the solution of F as I am not too comfortable with Iterative DP, so, I tried running bruteforce with my code and the given solution code. Then I stumbled across this two testcases.

TestCase 1:
Trouble that I am facing:
TestCase 2:
New Trouble that I faced:

I would love to hear from anyone who could help me to solve my problem. Thanks for taking the time to read.

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

    Your conclusion that the toggling of the top-left cell doesn't matter is wrong. The actual reason why the answer to your first test case is 1 is that the test cases are never supposed to have a 0 in the top-left cell, so the given solution code gives a weird answer.

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

Explanation for 105283D - Parallel Arrays is not fully precise — the claim that the minimum unused value among a[1]..a[i-1], b[1]..b[i-1] is equal to min(a[i-1], b[i-1]) + 1 is false which is confirmed by the sample. If that would be true then the minimum among 4th elements would be 4 (which is min(3, 6) + 1) and not 7 (which is actually the minimum unused element).

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

    Thanks for noticing that, the editorial has been updated.

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

can anyone explain ADVANCE E problem in detail with examples?

  • »
    »
    2 месяца назад, # ^ |
    Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

    Like you, I find it really hard to understand E's editorials, which is why I want to try writing one myself.

    Firstly some basic things: You must always type "orz" first before copying anything.

    After all pastes, no copies are required. Moreover, two or more consecutive copies are not necessary.

    We can see pastes like, typed orz for now $$$\times$$$ pasted times + 1 For example, if you write 23 times, copy, and paste 3 times, you will end up with 92 times orz.

    Also, we can say something like typed orz for now $$$\times p_1 \times p_2 \times \dots \times p_m$$$, since we know pastes in between consecutive copies and do not require typing. Since we know there are never two or more consecutive copies, we can say that at most $$$\log_2 N$$$ copies are required each time because we multiply it by at least 2.

    Furthermore, $$$p_1, p_2, p_3, \dots, p_m$$$ must be as similar as possible (max of them — min of them smaller or equal to 1)


    Solution:

    Let $$$x$$$ be typed orz for now and let $$$y$$$ be $$$p_1 \times p_2 \times \dots \times p_m$$$. Assuming $$$x$$$ is at least 1, we find that $$$x \times y \geqslant N$$$.

    It is obvious that $$$x$$$ must equal $$$N$$$ if copying time is 0. Thus, $$$A \times N$$$ is the answer.

    We only need to look at $$$2 \sqrt N$$$ values if we only used copying once, which means we multiply only one value. Because, $$$x$$$ or $$$y$$$ must be smaller than $$$\sqrt N$$$.

    Else we know used copying at most 30 times; if we fixed that value, we can brute force to pasting times (because in worst case, copying time is $$$2$$$ and $$$N$$$ is $$$10^9$$$, we only need smaller $$$2 * 4 * 10^4$$$ because we typed orz 1 time, copied and pasted $$$4 * 10^4$$$ times then copy again, and paste $$$4 * 10^4$$$ times so we typed $$$16 * 10^8$$$). So we can do that like $$$\mathcal{O}(30 * 30 * 10^5)$$$. It comes from we need to try copying 30 value, and pasting value $$$10^5$$$, and distribute 30 times too for $$$p$$$ array. (Also seems, editorial code uses a little bit different pattern so they don't need to distribute.)

    I tried to clarify it as much as I can, if you don't understand something you can ask me.

    • »
      »
      »
      2 месяца назад, # ^ |
      Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

      ", we only need smaller 2∗4∗104 because we typed orz 1 time, copied and pasted 4∗104 times then copy again, and paste 4∗104 times so we typed 16∗108 " in this why you typed orz 1 time, also how are you going to calculate the total cost, in terms of A,B,C

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

        From $$$2$$$ to $$$31$$$, we are applying copying time by brute force. From $$$1$$$ to $$$8*10^4$$$, we are brute forcing pasting time. (The loops are for loops.)

        We could compute $$$y$$$ in the manner of $$$\mathcal{O}(30)$$$ if we fixed copying time to $$$a$$$ and pasting time to $$$b$$$. At least $$$b/a$$$ is received by all, and $$$b \pmod a$$$ receives an additional $$$1$$$. Then just multiply them by pasted times + 1, which is their multiplying factor, to get $$$c$$$.

        At least $$$\lceil N/c \rceil$$$ typed orz is required.

        Update the response after that.

        For example:

        Let $$$A=1$$$, $$$B=2$$$, $$$C=3$$$, and $$$N=2300$$$.

        Fixing $$$a=3$$$ and $$$b=7$$$ will result in $$$c=(3+1)*(2+1)*(2+1)=36$$$. The required typed orz is equal to $$$\lceil N/c \rceil=\lceil 2300/36 \rceil = 64$$$.

        So update answer: $$$A*64 + B*3 + C*7=91$$$.

        We can show this process like:

        1. Typed {orz} $$$64$$$ times.

        2. After that, copy and paste three times. So we have $$$64*4=256$$$.

        3. I copied twice and pasted twice. So we have $$$256*3=768$$$.

        4. I copied once more and pasted twice. So we have $$$768*3=2304$$$.

        Additionally, since it exceeds $$$2300$$$, the order is correct.

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

Can someone explain problem E