Greetings to the Codeforces community!

Today in Saratov there is a second day of the local school competition, so we again introduce you a round based on school problemset. Round is for participants from Division II. Members of the first division can participate out of competition, as usual.

Round starts on 8-th of December at 09:00 UTC

Problems were prepared by employees and students of Saratov State U, including MikeMirzayanov, Fefer_Ivan, NALP, HolkinPV and me.

Scoring: **500-1000-1500-2000-2500**.

**UPD:** Congratulations to the winners:

**UPD:** tutorial.

What will be the scoring? Edit: Scoring added

I think scoring will be dynamic, because scoring of a first day of the competition (cf round #217) was dynamic.

What is dynamic scoring?

Experiment: dynamic problem max. scores

When the score for the problem depends on count of successful solutions.

I hate contests in unusual time (Do U know what is time?!)

I am coming

That's quite unfortunate choice of words :P

Forgot to register for the contest T_T. Realized when tried to submit :(

Found someone who wrote the following code

Tried to hack it with a test case where n is 100 ( My first attempt to hack a code in my life ) but failed. Is there any full proof way to make the code go out of bounds?

http://stackoverflow.com/questions/1239938/c-accesses-an-array-out-of-bounds-gives-no-error-why

Accessing an element outside array bounds is undefined behavior in C++, and this means that anything can happen: the program may crash, may print incorrect answer or may even work correctly.

what a greedy contest! :D

What is the logic behind Problem D?

You just need to simulate what the problem asked for. Fill certain container until it is full. Once full, pour the remaining water in the next container. If the next one is full too, try the next one until you find an empty container or you reach the floor. Finding the next container efficiently is the trick here. I used Disjoint-Set-Union data structure to quickly find the next container.

I used a segment tree, I initially thought of DSU but after that I thought that it would have too high of a complexity.

Why? If we use path-compression, isn't it just almost O(1)?

Disjoint-Set-Union is just enough... very small implementation... Nice problem :D

Seems I analysed it too superficial... alas, segment tree was good too.

I used the same idea in practise session but it is still showing TLE

Oops, my solution for Problem C & D both got WA6 unfortunately. Orz.

what was the idea for E?

Was this to sort the input and work with k consecutive parts ??

I tried this and got WA on pretest 2.

Solution is correct. There might be bug at your implementation.

Nice contest with really fast system testing :D

Can someone help me with B?

My approach was: 1. Factorize a in powers of 2,3,5. 2. Factorize b in powers of 2,3,5.

Answer will be sum of differences of power. To find power, I found all powers of 2,3,5 uptil 10^5, for fast calculation. Yet, for test case -> 1,000,000,000 999,999,999 — it was taking more than 2-3 seconds.

finding powers of 2 could be done like this

Which is the test 32 ¿? I can´t see tests in submissions :( I got accepted in practice, but I cant´t imagine slow behavior for any test.

Using bitwise operation could be faster:

More info

wonder why my submission 5386072 (using recursion) gave

MLE. my guess is that stack size of the judge is pretty low, because i used the exact same idea in practice submission 5388703 and gotAC.EDIT: i think the solutions and tests have not yet been made public, so u may need to wait for a few minutes to see them.

We can't see your solution.

I think that your solution made an infinite recursion. As I know, the stack size of the judge is equal to the memory limit of the problem.

When I try to see someone's solution here http://codeforces.com/contest/371/standings nothing happens. A pop up is there when I double click on the cell. But the submission link to show the user's actual code doesn't work for me. Any help?

You'll be able to see solutions after some minutes.

some errors ?

still not work now

Its working. Thank you.

I have a question about Problem B! In the first sample, how to get the output result 3 ????? I always think the result should be 2. That is, first, 20/2=10, then, 15*2/3=10, and over.

20=(2^2)(3^0)(5^1) 15=(2^0)(3^1)(5^1)

Make the powers equal, which will require 3 steps.

When Fox is dividing the cheese by 3, she TAKE 2/3 of it. So, if the size of cheese was n, after dividing it becomes n / 3.

20/2=10, ..10/2=5 ..and 15/3 =5 (because one third remains..two third is eaten)

Can anyone help figure out why my D is wrong at Test 6 Ans 34th ?? Thx.

Is there anyone love to share thoughts on problem E?

My implementation was sort station ids by their location. Then I guess the solution must be k consecutive stations. Then I scan from left to right. I got WA on 15.

Is my algorithm totally wrong or I missed something in my code? Thanks.

Your idea is correct but , update of 'sum' is wrong (at my opinion)!

That's true, so sad :(

I

Worst time ever :( Please move the hour or maybe the day xD