Codeforces Beta Round #10 took place on Thursday, 15th of April at 19:45 MSK. This time I am the author of the problems. I would like to thank the creator of the Codeforces Mike Mirzayanov for correcting the statements and Julia Satushina for the excellent translation problem statements into the English.

I want to apologize for the problem D. There was a bug in model solution. Moreover, this problem may not be solvable in polynomial time even with such constraints on the number's size. We will investigate it. I hope nobody will feel offended in any case.

I want to apologize for the problem D. There was a bug in model solution. Moreover, this problem may not be solvable in polynomial time even with such constraints on the number's size. We will investigate it. I hope nobody will feel offended in any case.

**UPD**: Now I am pretty sure that my model solution for the problem D was completely wrong. I want to apologize for it again. There will be no rejudge of the solutions accepted during the contest. The statement will be changed so that it will ask to find the LCIS of the two sequences. This problem definitely has a solution.**UPD**: Problem D was changed as I promised.
No need to thank me for each contest. Frankly speaking, I feel embarassed, and... ashamed for the comment I made some days ago (hope, you know what I'm speaking about). Forgot to ask you earlier not to mention me. Moreover, one of the translations is yours))

We'll see how good the translations are during/after the contest ;-)

From the bottom of my heart I wish you all the best! It is such a difficult think to make a contest (now I know this for sure). So, you deserve only the best))

Thank you!=)Forgot to say – it’s a difficult thing to make a contest, but it’s even more difficult to reconcile with the idea that you have to miss the contest and lose rating points… :-( For a programmer like you it’s hard… So, good luck one more time))

For a slightly more objective assessment, it might be interesting to calculate the percentage of Russians amongst those who solved the problem, and compare that to the percentage of Russians in the competition.

Maybe the version you read was the Russian one?

FOR(i,(N-1)%9+1,9) d[i]=(N-1)/9+1;

=>

FOR(i,0,(N-1)%9+1) d[i]=(N-1)/9+1;

FOR(i,(N-1)%9+2,9) d[i]=(N-1)/9;

the first line was: FOR(i,0,9) d[i]=(N-1)/9+1; not the above one.

http://graal.ens-lyon.fr/~yrobert/algo/coins2.ps

Once I've heard some lecture where some guy was talking about a criteria

to check whether a knapsack problem is greedy solvable. I thought maybe this problem

is also has a known solution, so I went straight to google and started to search. And after

some time I've found this.

Hints are:

Full solution is:

And, if you can, leave feedback for my mistakes in English. :)

http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.97.2394&rep=rep1&type=pdf

Personally, I thought the idea was to find this article, read it and implement during the contest.

Can somebody please write a tutorial for the updated D problem :)

In case of problem C, for N=4 why (1,2,2) and (2,1,1) is not among expected pairs?

We need to find the cases when the algorithm falters. By faltering, we mean — d(C)=d(d(A)*d(B)), but (C!=A*B). Here, in case 1 — (1,2,2), c is equal to A*B. Thus, we would get the right result from the function. Case 2 — The function would report the digital root to be different, thus, the algorithm doesn't falter and reports the expected result.

Can someone tell me how to solve E?

Can Someone tell me how to solve problem D ?

we need to build a graph over the elements after co-ordinate compression, consider two elements i,j if i is present before j in both sequences and i<j then we add a directed edge from i to j , now the answer is to find the longest path in a directed acyclic graph