Hi Codeforces!

It's our pleasure to announce the 10th edition of Bubble Cup. Bubble Cup is a programing competition organized by Microsoft Development Center Serbia (MDCS), and will be held this weekend. Contest will take place on Saturday, 2nd of September at 09:30 UTC, in Belgrade, Serbia. Live results will be available on the official Bubble Cup website (results will be frozen during the last hour of the competition). Winners will be announced at the closing ceremony.

Just like the two previous editions, this final will be followed by an online mirror competition on Codeforces. Mirror will take place on Sunday, 3rd of September at 10:00 UTC. Contest will last for 5 hours and ACM ICPC rules will be applied. It will be a competition for teams of 1-3 members. There will be at least eight problems.

We kindly ask participants of the onsite final to hold off discussing problems publicly until the mirror is over.

Contest was mainly prepared by employees of MDCS. We give our thanks to Nikolay Kalinin (KAN) for the round coordination, Mike Mirzayanov (MikeMirzayanov) and the team behind Codeforces and Polygon platforms. Special thanks goes to knightL for helping out with problem testing.

The contest will be unrated. The reason for this is because rules of this contest are not common for Codeforces. Also, it is only a mirror of an onsite competition.

Editorial will be available in the booklets section on the Bubble Cup website a few hours after the online mirror ends.

EDIT:

Here you can find mirror contests from the previous two finals:

Bubble Cup 8 — Finals [Online Mirror]

Bubble Cup 9 — Finals [Online Mirror]

EDIT #2:

The contest has started. You can see the live results on the Bubble Cup website.

EDIT #3:

Here are the results of the onsite finals.

The top three winning teams of the online mirror contest:

1. tourist, VArtem

2. zigui, molamola., dotorya

3. Um_nik, Kronecker

Complete rankings are listed on this link.

Congrats to all winners!

You can find contest editorial here.

EDIT #4:

Thank you for your comments. While our official and ainta's solution matched on the test cases provided we found out from the comments here that there are some edge cases we didn't handle correctly and don't know how to handle properly given the constraints. Because of that we decided to remove the problem from the set and reset all penalties people received from the incorrect submissions. Sincere apologies to everyone affected by this.

Auto comment: topic has been updated by niksmiljkovic (previous revision, new revision, compare).I read on the official site that the onsite finals only allow C/C++/Pascal. Will the online mirror allow all the usual Codeforces supported languages (or at least Java)?

It will allow all languages supported on Codeforces, atleast that was the case in previous years.

The online mirror will allow all languages supported by Codeforces. However, we can't guarantee that all problems will be solvable in each language.

Is it harder than normal CF contest???

Here is booklet of Bubble Cup 2016, it contain problems also: http://www.bubblecup.org/Content/Media/Booklet2016.pdf

Tanks.

Blog post is updated with the links to the previous two Bubble Cup mirror contests.

tank you.

Is was contest rate plz I need now teechr will fail my?

Will there be T-shirts like last year?

Unfortunately, there will be no T-shirts this year. There are some custom laws that are complicating shipments from Serbia to Russia.

We are working on finding an alternative way to provide T-shirts, and if do find it, we'll update the blog post.

The same for T-shirts for previous year? Maybe you can send them to other country? Please write me to PM if it is possible.

Who will join this contest in spite of unrated, put like.

Auto comment: topic has been updated by niksmiljkovic (previous revision, new revision, compare).Is it rated?

No.

From the blog post:

The contest will be unrated. The reason for this is because rules of this contest are not common for Codeforces. Also, it is only a mirror of an onsite competition.

Bubble sort Cup, amazing!!!

Is it rated?

Upvote me or be bad at code!

Get upvoted cool kid

https://www.babiesbloomstore.com/offers.html

I as well would like to know in the fullist if this contest on the code force will count towards my codeforce rating on the codeforces.com webite on the internet on the wires that are inside the tubes that the internet is made of.

Bad luck. Solution for A and C was correct. If these two got rated then.... Alas! they got skipped.

How many computers will teams have during finals ?

Each team will be provided with one computer.

sorry but i have to ask is it rated?

is it a team contest?

if answer is yes so why we cant register as a team?

Yes, the registration page will be updated soon to allow team registration.

May I ask how to register as a team member? The register page doesn't have this choice.

you think i will say "is it rated" ? No! i just want your downvotes lol

Where are final results?

Radewoosh's team won, second place for Jagiellonian Armadillos from Poland and third place for Cheeks from Russia. From facebook.

I know, I asked for detailed results

It's in the post you. Can't you read?

Results on site are before freezing. TOP3 had 9, 8, 7 problems respectively

Team of tourist and VArtem opens the scoring...

Also me, but they kicked me from their team.

How to solve problem I?

Mo's algorithm on tree

Guy who wrote this:

should seriously urgently learn some math

Yes. I did and solved problem C in my team, but I got stuck at this symbol, and I throwed two questions... (I spent ~15 minutes to read this and understand the symbol, but overall the contest was good and

fun.)How to solve A correctly?

One could calculate dynamics d[x] for numbers <= 9 * 200000 + C how fast we could reduce

xto one digit. Call numbers with d[x] >= 3 bad. If sum of digits ofA0 is not bad all is ok. Let's take nonzero digits in A and remove plus after them (merge two digits in one two-digit number), if the new sum will be good we will stop, otherwise continue this process. On every stepA1 will increase on 9x, 1 ≤x≤ 9. If inA0 there arendigits we could perform at leastn/ 2 such steps. One could calculate another dynamics on "bad" numbers and see that it will not help only for 379 and 388. If sum ofA0 digits is 379 or 388 we will merge on the first step 3 digits and then do the same staff.Will the problems be open to solve again soon?

How to solve F?

The solution is

a^{(mCn + mCn - 2 + ...)},a^{(mCn - 1 + mCn - 3 + ...)}, ...a^{(mC2 + mC0)},a^{mC1},a^{mC0}find the

xs.t. and as it is prime, find modular inverse and calculate.What's the intended solution for problem H? I've come up with a

O(N^{ 3}×K) solution. Is it fast enough?It is

I also doubted that, but it ran in 826ms somehow

I think There is an O(N^2 * K + N^3) solution (with preprocessing sorting-by-angle).

Wow, that would be great, can you elaborate?

Sorry. I miscalculated time complexity :(

When can we submit codes after this contest?

I was only a few seconds late :(

You should be able to submit now.

Was the intended solution for B

O(m^{4}) polynomial multiplication?I have solution in O(n + m^2logl) so i think O(m^4) might be too slow.

Could you please elaborate?

Edit) I got the solution you are referiring to from someone else. Thank you for your help.

How do you multiply two polynomials in m^4 :P?

The were polynomials of two variables.

The way interpreted the problem was essentially to calculate

where

cp_{i}is the number of timesiappear in the arraycfor all (x_{i}) s.t.so we tried to multiply the polynomials

and sum over all the coefficients of

x^{L - 1}y^{M - k}by multiplying them with the number of wayss_{a}+c_{b}+e_{b}=kvia counting sort.Could someone please help us with a better solution?

Let's assume that costs from first city and to last city are zeros for simplicity. Then create a polynomial and calculate and take its

x^{0}coefficient. You can do it in . You can very easily add costs from first city to that solution. To include costs to last city you need to take out one of middle layers and join it with last layer because if you go to some city in last layer you have already determined cost to last city (as opposed to costs from first city to first layer where city you're going to from first city has no influence on next cost).Solved it in

O(m^3logL+N)using matrix multiplication.can someone explain how to solve problem A correctly?

and btw what is the 6th test case ..

A simple greedy of putting them all into single digits does not work. Say for example we have

(something) + 1 + 3 + 4 = 66 -> 6 + 6 = 12 (so impossible)

but if we do

(something) + 134 = 210 -> 2 + 1 + 0 = 3 (so possible)

I expect TC6 to be an example of this.

thanks :)

It wasn't so cool to waste a hour with correct but not very optimized solution for I. What was the purpose to set TL to 2s? Is your solution too?

Anyway well problems :)

Is it possible to solve D without binary search. Like adding edges in sorted order and updating flow? I submitted that code but it got TLE. I don't know is it correct or why it got TLE.

Edit: Not B, D.

For D — Exploration plan,

My submission of D is using Binary_Search together with MaxFlow, but WA on test 6. My Submission

However, it seems many accepted solution divided a single node into two group.

First group is attached to the source. Second group is attached to the sink. And then add edge with the constraints of Binary Search, like

`add_edge(i, j + n)`

So I want ask that "is there a way to construct the graph without dividing the vertex?"

It is something like

`add_edge(i, j)`

.Thank you!

Why my submission of J changed to Accepted? Were there some wrong test datas?

I am sceptical about editorial to J...

After reading the editorial for Problem , I am certain they literally copy-pasted the technique explanation from my blog and changed a couple of words here and there..

Unsurprisingly, that is how I solved the problem during the contest as well (Copy the code in the blog -> Change Inputs -> Submit -> Profit). Seems like even they submitted this.

EDIT:

Why am I being downvoted into oblivion? I didn't say anything untrue, did I? The editorial literally uses the same variable names (

STandEN) and copies the two cases verbatim from my blog. (the language is exactly the same)I found a counterexample for ainta's solution of J.

is same as

and the answer is 2, but output is 3.

EDIT:

I think that answer for that case is even 1 as shown by this configuration

But yeah, that doesn't change that model solution to J is shite and is not correct.

Yes. zigui's example is a counterexample of my algorithm. But I think

is not same as zigui's example. In zigui's example, for every input, output is 2 (probability : 1/2) or 4 (probability : 1/2), but yours is not.

We (Polish guys) had a discussion on how shitty and unclear was statement of this problem and its details, but it seems it is even more unclear than I have thought. I was convinced that we are interested only in amount of water that falls to every cell (which is 1/2 for 2 and 4 and 0 for 1, 3 and 5 in all mentioned cases) but it seems you're suggesting that we should also care where did that water come from. I think I will stick to my version, but who knows what organizers meant when saying "distribution of water"

At first, I understand the same way but soon I realized I can't manage that problem.I agree with that description of this problem is very unclear and hard to read.

Auto comment: topic has been updated by niksmiljkovic (previous revision, new revision, compare).Oh, so we've maxed the onsite, good to know :3

You are doing such a great work. I really appreciate your efforts towards your blog. Cheap Price of Wrist Watch Thank you.

I was an official finalist and when I did the online mirror (it's unrated anyway so why not, we were only asked not to discuss problems in public, and participating in the mirror does not really count as such), someone kept removing my submissions, marking them as skipped. Not a problem, until I found out that they accidentally removed one submission from practice I had previously done! Please be more careful next time!