Hello, Codeforces! I'd like to invite you to Codeforces Round #289 (Div. 2). It'll be held on Saturday, January 31 at 15:00 MSK and as usual Div. 1 participants can take part out of competition.

This round will be carried out according to the ACM rules, which means that you get verdict of your solution on-line, and the duration time is 3 hours.

These differences in the rules are caused by the fact that **this round is the second qualifying round for the WCC**, which stands for Winter Computer Camp and can be also mentioned as ZKSH. Official school website — hhttp://it-edu.mipt.ru/en/zksh2015. There you can find the selection rules for WCC.

If you are a school student and you want to participate in the selection to WCC here are the steps:

- Sign up for the school at http://goo.gl/kz2qSf, if it was not done earlier.
- Create a free account at codeforces.com, if it was not done earlier.
- Sign up for the round on the link http://codeforces.ru/contestRegistration/509. You should put a tick in the box "Do you want to participate in the selection to WCC?", and provide your last name, first name and email, which you entered for registration in the first step.

If you have any questions feel free to write to the address of the organizing committee: zksh-team@phystech.edu.

The authors of the contest (WCC technical committee) are really grateful to Max Akhmedov (Zlobober) for the help with preparation of this round, Maria Belova (Delinur) for translation of statements and Mike Mirzayanov (MikeMirzayanov) for contribution to the development of programming by creating systems Codeforces and Polygon.

**UPD. Tutorial — http://codeforces.com/blog/entry/16119**

I have 2 question :

1)Are there any T-shirts ?

2)rated?

1) According to the results of the competition, top 5 students, who will take part in WCC, will receive prizes. 2) Rated, I hope =)

thank you :)

if it is not rated then why it is div2 only?

it is rated only for div2 participants

You can use this picture :)

Can Div1 contestant participate in the selection to WCC?

Yes, of course

The sign-up is in Russian. Is the WCC available only for Russian speaking students?

If you look closely, there are English translations below each Russian statement.

I want to know how many questions are there?

I think 5000 users register for contest :)

During the contest I can realize that I am in Computer AGE.are you??

Will the problems be arranged according to the expected order of difficulty? Also will there be a scoring system or we'll be rewarded on problem count and submission times with 20 mins penalty for wrong submissions?

"we'll be rewarded on problem count and submission times with 20 mins penalty for wrong submissions" is correct. I can't promise anything about tasks.

Okay , thank's.

I hope that these rules used in all contests on codeforces ..

Standard input/output?

How many tasks?

Hacks or no hacks?

Full feedback.

:(

is this rated?

for div2 yes

Can I participate in this contest without signing up/registering for WCC?

Yes, of course

TODO: update comments before sending.

What time during the contest will the scoreboard be frozen?

No freeze

It looks like scoreboard is now frozen, if I am correct.

Hope to become expert this round))

你好

Are you sure that people in here can understand what you say?

Google translate: "Hello" Chinese.

By using ACM ICPC rules, does it imply that the language restricted (only C, C++, Java)? I hope it does not.

UPD: my bad. I just opened the rules. We can also use Pascal and Python.

I think, every language supported by Codeforces, will be available.

Oops, my bad (again). Thanks for the clarificaton, nic11! :)

You are absolutely right.

let the game begin.. Good luck for all

It's 15 minutes past the contest .. and I can not submit my code for A :/

Nice System Of A Down reference in Problem E :)

(IEAIAIO and BYOB are both songs by System Of A Down)

And dreamoon_love_AA finally has done it! Congrats!

yeah he did it! Congratulations! =D

i'll wait for dreamoon_love_AA vs sorry_dreamoon again :)

Nice problem :)

thanks map

Sorry to say this but, imo(i dont know about others) your problemset was the worst i've seen in codeforces.

Why do you think so? I really liked problems, especially F, even though I have no idea how to solve it.

Well i myself dunno how to solve F but A-D were really bad

What are you talking about? They were really good problems. Also, problemsetters put a lot of their time and effort into making such problems. Try to be grateful and don't dishearten them with such comments.

What is bad in D?

F was nice, but yeah I didn't really like many of the others.

That problem C -_-

what is the 7th test case in problem C?

same problem

I don't know the test itself but what's your soln for this input?

2 300 300

3999999999999999999999999999999999 4899999999999999999999999999999999

Try 10 38 38 38 38 38 38 38 38 38 38

answer: 29999 38999 39899 39989 39998 47999 48899 48989 48998 49799

my code prints the same as yours, but still wa at 7

what about 8 1 1 1 1 1 36 20 21 answer: 1 10 100 1000 10000 18999 19019 19029

I see, thanks

How do you solve E ? I feel it is dp but not sure how.

you can have a look at my solution .. i did it so simple you even can't believe .

Is it faster than O(nlogn)? I can't view your solution now.

is is O(n)

it is*

My solution is O(n).

Let call

a_{i}= 1 ifs_{i}is a vowel elsea_{i}= 0.sum_{i}=a_{1}+a_{2}+ ... +a_{i}Number of vowels in all sub-strings with length x is:

P_{i}= (sum_{x}—sum_{0}) + (sum_{x + 1}—sum_{1}) + ...= (

sum_{x}+ ... +sum_{n}) — (sum_{0}+ ... +sum_{n - x})The result is sum of

P_{i}/ithere can be something like this http://pastebin.com/E2pCyWmu

I didn't solve it either but I think it's dp too. We look at each letter independently and if it's vowel we add to answer sum of some harmonic serieses (we can calculate it using this value for last letter and array of prefix sums of harmonic series)

UPD: now I see that I was wrong and it can be solved easier another way.

Consider the vowel in the string at the position

i. It contributes to the answer only addends of the form , wherek≥iandj≤i, because it is only contained in the substrings of the forms_{i..j},j≤i≤k. After what, we can sum this expression for alli,j,ksuch thats_{i}is a vowel andj≤i≤k. Plugging this into WolframAlpha, we can get the final formula for the answer: , whereH_{i}= 1 + 1 / 2 + ... + 1 /iis the i-th harmonic number.When will we be able to look at others' solutions?

How to solve problem C? I saw a lot of accept is this problem, but I didn't know how to do it.

At the each step remember a last output value and a sum of digits in it. Then add 1 to last value and try to get the smallest integer which has the desirable sum of digits. To do it basically set less significant digits to 9 if you need to make sum of digits larger or set them to 0 (and +1 to digits before them) if you need to make it lesser.

Use bignum arithmetic.

Thanks a lot!

What if the sum of digits is same?How can we determine just next bigger number?

Hi, when will the practice problemset become unlocked?

Any idea about how to solve prob. E ?

Magic 9648904

Why magic? :)

It`s my code: 9652904 I have no idea about how you code works. My solve calculate count of intervals with length one divided by one, length two divded by two (etc.) for all positions (array VAR).

It took me half an hour to push formula...And I solved this problem. answer=(1/2 + 1/3 + ... + 1/n)(a[1]+a[n])+2*(1/3 + ... + 1/n)(a[2]+a[n-1])+...+(n-1)(1/n)(a[n-1]+a[2])+a[1]+a[2]+a[3]+...+a[n] if a[i] = I or E or A or O or U or Y then a[i] = 1 n means length of string And it's my code: http://codeforces.com/contest/509/submission/9654437 :-)

I really wrote bad and long solution for C but finally I got accepted :D

I also wrote bad and long solution for E and I got accepted :-)

Your E solution is actually three times shorter than mine. It's not bad and long solution in my opinion o.O

When clicking on submit button on the right, I sometimes had to wait around 3-5 minutes before my solution got accepted since previous 3 contests. :(

All other websites were working in a decent speed on my internet connection during the time of the contest.

Has somebody else faced this lag, or I do I need to get an alternate connection.

same here site page for submit will not open..

It is always laggy for me too while I am in college but works fine when I am at home . You could go to IPC or library for faster speed.

map, when the editorial would be available ?

Part of tutorial is available

We hope to finish it today.

riadwaw, Your llink is the link of this post, no editorial. :(

UPD:I think Now it is fixed.Fixed, thanks

riadwaw, Thanks for the link and a big hand for the editorial. :)

Hi, do you happen to know when the problemset part of the site becomes unlocked?

Unfortunately, I don't know it. Probably some action from administration is needed.

http://codeforces.com/contest/509/submission/9645857 Why am i getting Wrong Answer on test 1, output is correct on my pc.

But in the system and ideone, your program gives "NO" as the output of the first test case, while the answer should be "YES"

but your array sizes are

`102`

and your for loop define is`<=`

.Don't try to use defines if you are not familiar with them.

Got it thanks

Nice contest. Me mostly enjoyed problem C, stringy one.