Comments
0

Thanks for fast editorial and good problems.

0

I got the expected output for your testcases but still failed pretest

For G, the number of spins should be ceil instead of floor?

Thanks for fast editorial

On liouzhou_101Codeforces Round #700, 5 years ago
0

It passed when I resubmitted the exact same code O.o

On liouzhou_101Codeforces Round #700, 5 years ago
0

Hello, could you rejudge my problem B please? Thank you!

Thanks for the contest!

Same bro I keep getting WA on test 2

May I know what is pretest 2 of B?

UPD: Managed to solve it, my brute force was not brute force enough and missed some corner cases sigh

Thank you for tutorial!

I will give you an example to think about the idea. Let's say we have 3 distinct numbers (we will use the positive numbers since it is easier to reason about) [a, b, c] where a > b > c.

Calculating the sum of differences for a:

  = (a - a) + (a - (-a)) + (a - b) + (a - (-b)) + (a - c) + (a - (-c))
  = 0 + 2a + a - b + a + b + a - c + a + c
  = 2a + 2a + 2a = 6a

In general, with [a_1, ... , a_n], where a_1 > a_2 > .. > a_n, then sum of differences for a_1 is as follows:

  = 2a_1 + a_1 * (n-1) - (a_2 + a_3 + ... a+n) + a_1 * (n-1) + (a_2 + a_3 + ... a_n)
  = 2a_1 + a_1 *(n-1) + a_1 * (n-1)
  = 2 * n * a_1

From this, you can find the value of a_1. Next, the way I thought about it was to consider [a_2, ..., a_n] (i.e. disregard a_1). But one thing is sum of differences for a_2 would be subtracted by 2a_1. This is because there is a term in the original sum of differences for a_2 (which includes a_1):

(|a_2 - a_1| + a_2 + a_1) = a_1 - a_2 + a_2 + a_1 = 2a_1

since we are disregarding a_1, we should subtract it by 2a_1.

After subtracting, just do the same method as before to find a_2, then just do it until a_n.

Hope this helps bro. Took me awhile to figure out.

I like how D had such a clean solution.

Thanks for contest! C was very nice to solve.

+8

Thanks for the contest!

Interested bro

0

I got a nasty bug where I did not check if the neighbors that were previously not a hill/valley became a hill/valley after changing the value of a[i]

0

Since contest is over, may I get some hints on how to solve problem C?

I have a different solution for F, where I keep a offset between the top and bottom pointer, and use some case analysis. Time is O(mlogm).