Repovive Starter Round 4 Participation Report

It’s me.

I participated in Repovive Starter Round 4. I solved 3 problems.

Problem C was quite interesting. As I expected, international contests tend to have many of these kinds of observation-based problems, which makes them fun.


Problem A Different Parity

To summarize, the problem asks to determine whether an integer interval [l,r][l,r] contains both odd and even numbers.

If lrl\ne r, the interval contains at least two consecutive integers, so it will always include both an odd and an even number.


Problem B Balanced Trio

The Yes/No part can be determined by whether (a + b + c) % 2 == 0 is satisfied. However, I spent quite a bit of time on the construction of the solution.

Without overthinking, you can construct it using the following steps:

  1. Let TT be the target sum for each group.

    T=a+b+c2T=\frac{a+b+c}{2}
  2. Prepare an array V1V_1 to manage a1,b1,c1a_1,b_1,c_1, and an array V2V_2 to manage a2,b2,c2a_2,b_2,c_2.

  3. Iterate through a,b,ca,b,c in order. Add the values to V1V_1 until the sum of V1V_1 reaches TT, and then add the remaining values to V2V_2.

You just need to be careful to split a single value between V1V_1 and V2V_2 only if adding that value would cause the sum to exceed TT.


Problem C Corner Meeting

In summary, there is a grid with sides of n+1n+1 cells, and pieces AA and BB are located at (0,0)(0,0) and (n,n)(n,n), respectively.

  • Piece AA: Moves up, down, left, right, or stays put.
  • Piece BB: Moves in four diagonal directions or stays put.

The problem asks for the minimum number of moves for both pieces to reach the same cell.

After experimenting with cases up to about n=8n=8, I realized that meeting on the diagonal of the grid seems optimal.

Let the meeting point be (i,i)(i,i). If we denote the minimum moves required to reach that point as MAM_A for piece AA and MBM_B for piece BB, then:

MA=2i,MB=ni\begin{aligned} M_A &= 2i, \\ M_B &= n-i \end{aligned}

Therefore, you just need to use binary search to find the maximum ii that satisfies MAMBM_A\le M_B.


Problem D Distant Transfers

I didn’t really understand this one. I think you could determine if a solution exists by taking prefix sums and checking if any negative values appear, but to be honest, I was completely lost.


Repovive seems to be a small-scale competitive programming site with the number of participants still in the triple digits, but there are some interesting problems here and there.

So, for all you contest enthusiasts out there, why not give it a try?

See you later.