By NALP, 13 years ago, translation, In English

149A - Business trip

First, it is clear that if the sum of all numbers ai is less than k, then Peter in any case will not be able to grow a flower to the desired height, and you should output <<-1>>.

Secondly, it is easy to see that if we want to choose a one month of two, in which we watered the flower, it is better to choose one where the number of ai is more. Thus, the solution is very simple: let's take months in descending order of numbers ai and in these months water flowers. As soon as the sum of the accumulated ai becomes greater than or equal to k — should stop the process, the answer is found.

149B - Martian Clock

In this task required only the ability to work with different numeral systems. Let's try to go through numeral bases, each base to check whether it is permissible, as well as convert hours and minutes to the decimal system and compared with 24 and 60, respectively.

What is maximal base, that we need to check? In fact, it is enough to 60, because 60 — upper limit on the allowable number. It follows from the fact that if the number in an unknown number system consists of one digit, then its value in decimal not ever change, otherwise its value is not less than the base.

It is also worth to consider the case with the response <<-1>>, for this example, you can check a big base, such as 100, and even if the time for him correct, then for all large, it is also correct and the answer is <<-1>>.

149C - Division into Teams

Sort all the boys on playing skill. Then, if we send in the first team all the boys standing in a sorted array for odd places, and the second — even standing on the ground, then all requirements for division executed.

The first two requirements are obviously satisfied.

To prove the third we consider the geometric representation: Let each child designated point on the X axis with a value equal his playing skill. Connect the points with segments numbered 1 and 2, 3 and 4, and so on. If n is odd, then join the last point with the nearest the previous one.

Obviously, all these segments don't intersect in pairs, except at the points, and their total length is equal to the difference amounts to play boys' skills contained into the first team and second team. It is also clear that all of these segments completely contained in the interval [0, max(ai)], as well as the pairs are a length of zero crossing, the third requirement is satisfied, which we proved.

149D - Coloring Brackets

We introduce the notation of colors: 0 — black, 1 — red, 2 — blue. Note that a single pair of brackets has 4 different coloring: 0-1, 1-0, 0-2, 2-0.

Consider the dynamic programming, where the state is (l, r, cl, cr), where the pair (l, r) defines a pair of brackets, and cl and cr denote a fixed color for them. The value of the dynamic is a number of ways to paint all the parenthesis brackets inside the interval (l, r) in compliance with all conditions.

We write down all the pairs of brackets that are directly placed into a pair of (l, r), let k of their pieces. Moreover, we consider only the first level of nesting, it is directly attached.

In order to calculate the value of the dynamics for the state, within this state shall calculate the another dynamic, where the state is a pair (i, c) which means the number of correct colorings of the first i directly nested parentheses, and all inside them, if the latter closing bracket has a color c. Calcing the values of this dynamic is very simple, let's try to paint a (i + 1)-th parenthesis in one of four variants, but you should keep in mind possible conflicts. In such dynamics the initial state is a pair (0, cl), and the final result is sum over the states of the form (k, c), where c must not conflict with the cr.

The answer to the whole problem may be calced as the internal dynamic. Time of solution — O(n2) by a factor of about 12.

149E - Martian Strings

We will solve the problem separately for each m strings. Thus, suppose we have a string p, its length is l, and we need to check whether the Martian be seen.

We introduce additional arrays: let pref[i] is minimal position in the s of the begin of occurrence p with length exactly i, and let suff[j] is the maximum position in the s of the end of occurrence p with length exactly j

It is easy to understand that a Martian could see the p, if there exists an i, that suff[l - i] ≥ pref[i] + l - 1.

How to calculate the arrays? For pref array is sufficient to find Z-function p#s, but for an array of suff — Z-function r(p)#r(s), where r(t) means the reversed string t. Using an array of Z-functions calcing of arrays suff and pref is trivial.

Full text and comments »

  • Vote: I like it
  • +41
  • Vote: I do not like it

By Polichka, 13 years ago, translation, In English

Hello everybody!

Today Codeforces Round # 106 for Div2 participants will be. And all who wants can take part in this competition. You will have the opportunity to break from parents with Peter, to learn some interesting facts about the Martians and to solve, of course, interesting problems for you as we hope.

This round has been prepared by a team of three people: Gerald, NALP и Polichka. We express our gratitude for their help to Artem Rakhov (RAD), Mike Mirzayanov (MikeMirzayanov) and Maria Belova (Delinur) .

Score distribution: 500-1000-1500-2500-2500.

Good luck and high rating to all!

Full text and comments »

  • Vote: I like it
  • +129
  • Vote: I do not like it

By Nickolas, 13 years ago, translation, In English

A couple of days ago I was asked to answer the question "What is it like to be a problem writer for programming competitions?" at Quora web-site. My first idea of the answer had only one word, but then I've thought of a more detailed one, and then of a story I must include, hmm, and I should definitely mention this... Around the second page I realized that this is becoming more than an answer, and at the third one I decided to share this article with a qualified audience — that would be you.

So, what is it like to be a problem writer for programming competitions?

In one word (the one I've thought of at first), it's "awesome". In a bit more detail, "hard, sometimes unrewarding, but anyways fascinating job". In even more detail...

Full text and comments »

  • Vote: I like it
  • +216
  • Vote: I do not like it

By Nickolas, 13 years ago, translation, In English

So, here goes the editorial. I'll tell you right away that nobody guessed MikeMirzayanov's problem (nice disguise, er?) — it was problem C about the picky princess. Actually, this was the first problem of the round, the rest of problems I invented to keep up the lovely topic.

148A - Insomnia cure

The number of dragons D can be quite small, so the problem can be solved in a straightforward way, by iterating over dragons 1 through D and checking each dragon individually. Time complexity of such solution is O(D).

Full text and comments »

  • Vote: I like it
  • +47
  • Vote: I do not like it

By Nickolas, 13 years ago, translation, In English

Hello,

Codeforces Round #105 will take place on February 2nd, 20:00 Moscow time.

This is a themed round, based on the fairy tales I write in Russian.

In this round we decided to conduct an experiment on smoothing the effects of problem setters misestimating the complexities of the problems: all problems have point values of 1000. We tried to order the problems by increasing difficulty, but this is a subjective opinion, so surprises are possible.

Thanks to MikeMirzayanov for the problem contributed to the round (who can guess which one of the five is not mine?) and to RAD for his help in preparing the problems.

Good luck at the round!

Full text and comments »

  • Vote: I like it
  • +166
  • Vote: I do not like it

By freopen, 13 years ago, translation, In English

Hi there. I invite you to participate in my contest. It will take place in Codeforces::Gym at 15:00 (Moscow timezone — UTC+4) (Time in other regions).

Problems are rather easy, so it will be more interesting for div2 participants.

** Warning: I have only russian statements. This contest is only for those who can understand russian statements.**

Good luck

Alexey freopen Zolotov

Full text and comments »

  • Vote: I like it
  • +67
  • Vote: I do not like it

By MikeMirzayanov, 13 years ago, translation, In English

Since almost every member of the community Codeforces know how to write programs, we decided to abandon the wysiwyg HTML editor, and introduce a geek method. Of course, technical texts will gain much more convenient, and text will look uniform.

Now we use modified Markdown as a markup language for blog posts and comments. Since we use an additional extensions, we called markup simply Codeforces Markup. Codeforces custom tags are available in the editor, I will publish a description of the rest here a little later. In a few words it looks like simplified previous version — double square brackets are replaced by single square bracket.

In addition, we improved typography posts and comments.

See description Markdown using the links:

Here's a short list of features:

  1. insert user handle (use ~tourist);
  2. italic and bold;
  3. inline code — return a == 0 ? b : gcd(b % a, a); (place it between `);
  4. numerated, unnumerated and nested lists;
  5. headers;
  6. autocorrection hyphens with dashes;
  7. smart URL detection (makes them to be links) http://codeforces.me/;
  8. tables and images;
  9. source code highlighting;
  10. "smart" quotes;
  11. separate paragraphs with a blank lines;
  12. special Codeforces tags;
  13. insert photos like [photoalbum:PicasaPublicAlbumURL];
  14. and much more!

I recall that on Codeforces implement preview, so you do not need crazy experiments on the Markdown in comments:)

MikeMirzayanov

Full text and comments »

  • Vote: I like it
  • +97
  • Vote: I do not like it

By MikeMirzayanov, 13 years ago, translation, In English

On January, 27 we summed up the results and rewarded the laureates. They are:


tourist
The Best Codeforces Participant 2011

Ripatti
The Best Codeforces Problemsetter 2011

Alex_KPR
The Best Codeforces Blogger 2011
  • The Best Codeforces Participant 2011: Gennady tourist Korotkyevich. We've recounted the rating taking only the 2011 rounds into consideration. Gennady topped the table well ahead of everybody else! You can follow the link to track his success on Codeforces contests.
  • The Best Codeforces Problem Writer 2011: Artem Ripatti Ripatti. In 2011, Artem prepared about 10 rounds on Codeforces and proved to be an author of interesting problems as well as a responsible partner. We are grateful to Artem for the help to the project and we hope for further collaboration.
  • The Best Codeforces Blogger 2011: Alexander Alex_KPR Kouprin. Alexander's blog (mostly in Russian) frequently delighted readers with interesting posts. His reports on the Russian Code Cup, the ACM-ICPC finals, Petrozavodsk training camp aroused interest not only in regular readers but also attracted some new ones. Thank you!

The Codeforces project thanks all participants and post authors for the interest towards the project. But we want to say our special thanks to all problem authors!

MikeMirzayanov

Great news! I've received congratulations to the winners from Thomas Cormen (thank you!). Here is the full text:

Mike,

My apologies for the delay in responding. It has been an exceptionally busy term for me, teaching our new introductory course in Python (I'm learning the language along with my students), supervising our senior capstone project course, and chairing our department. You may post the following statement on your website:

Congratulations to Gennady "tourist" Korotkyevich (Best Codeforces Participant 2011), Artem Ripatti (Best Codeforces Problem Writer 2011), and Alexander "Alex_KPR" Kouprin (Best Codeforces Blogger 2011). Although Mike Mirzayanov hinted that we might be in for a change this year, I was not too surprised to see that "tourist" took the top participant spot once again. I applaud the winners and everyone else who takes part in Codeforces.

Tom Cormen
Professor and Chair
Dartmouth College Department of Computer Science
http://www.cs.dartmouth.edu/~thc/
Twitter: @thcormen

Full text and comments »

  • Vote: I like it
  • +112
  • Vote: I do not like it

By paladin8, 13 years ago, In English

Hey everyone,

There are no CodeForces rounds coming up, so I thought I would set up a training round in the new Gym. The problems are from our local contest which I helped organize last October. We used it to select our team for the ACM-ICPC. There is a large range of problem difficulties, so I am sure everyone will have interesting problems to solve.

It will be held on Saturday, 1/28 at 8am Moscow time (4-hour contest) in the CodeForces Gym. I hope you enjoy the problems!

Update: The contest is over. Thanks for participating! If you didn't, please check out the problems anyway :) Feel free to discuss the problems in the comments below; I can outline solutions but I don't have a formal editorial.

Full text and comments »

  • Vote: I like it
  • +92
  • Vote: I do not like it

By MikeMirzayanov, 13 years ago, translation, In English

Not so long ago in the English Wikipedia has been added to the article about Petr Mitrichev (Petr). Currently, there is a discussion of this article for removal due to the lack of significance. Here is a quote from the discussion: "I don't see how Petr is notable in Wikipedia standards. What makes him different from the hundreds or maybe even thousands of others who are on a similar level as him at competitive programming?".

By the way, there is the article about Reid Barton, the outstanding contestant from US. Who is more valuable for the history?

It would be nice if those who is familiar with the rules of Wikipedia, added to the discussion to support Petr.

By the way, the article actually seems incomplete and not disclosing the success of Peter. Maybe someone will undertake to improve?

Comments?

Full text and comments »

  • Vote: I like it
  • +192
  • Vote: I do not like it