By PikMike, history, 41 hour(s) ago, translation, In English,

On Sep/20/2018 17:45 (Moscow time) Educational Codeforces Round 51 (Rated for Div. 2) will start.

Series of Educational Rounds continue being held as Harbour.Space University initiative! You can read the details about the cooperation between Harbour.Space University and Codeforces in the blog post.

This round will be rated for the participants with rating lower than 2100. It will be held on extented ACM ICPC rules. The penalty for each incorrect submission until the submission with a full solution is 10 minutes. After the end of the contest you will have 12 hours to hack any solution you want. You will have access to copy any solution and test it locally.

You will be given 7 problems and 2 hours to solve them.

The problems were invented and prepared by Roman Ajosteen Glazov, Ivan BledDest Androsov and me.

Good luck to all participants!

Our friends at Harbour.Space also have a message for you:

Harbour.Space University is proud to announce new partnerships for this year’s Hello Barcelona Programming Bootcamp — VTB and Indeed Tokyo, with the addition of team sponsors Phaze Ventures and Spark Labs.

VTB, the largest international bank based in Eastern Europe, continues to be an official partner of our Hello Programming Bootcamp series, adding further quality to the 3rd edition of the Hello Barcelona Programming Bootcamp by bringing their own participants, as well as by supporting top teams from around the world.

Indeed Tokyo is Japan’s branch of the #1 employment website in the world, giving job seekers free access to millions of jobs from thousands of company websites and job boards. As they sponsor for the second year in a row, Indeed continues to offer the best job opportunities to the boot camp participants as they gather in Barcelona from September 26 to October 4, 2018.

UPD: There was a bug in testset and validator for problem F, we are currently fixing the issue. The statement included the correct resrictions. We will rejudge all the solutions as soon as possible. The round can become unrated, we are discussing this at the moment.

Read more »

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

By ditoly, history, 23 hours ago, In English,

Hello everybody!

I'm glad to invite you to Codeforces Round #511 which will take place on Sep/21/2018 17:35 (Moscow time).

There will be 7 different problems in total, and 5 problems in each division. You will be given 2 hours to solve them.

The problems are prepared by me (ditoly), FallDream and ACMLCZH.

Thanks to 300iq who helps a lot in the round coordination, gritukan, V--o_o--V, demon1999, isaf27, cyand1317 for problem testing and MikeMirzayanov for the platform.

This is my first Codeforces round. Hope you can enjoy it. Good luck!

Read more »

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

By hmehta, history, 4 days ago, In English,

Topcoder SRM 737 is scheduled to start at 07:00 UTC -4, Sept 19, 2018.

Featured Problem Writer: Blue.Marylucyanna2018 on codeforces!

You will be able to register for the SRM in the Arena or Applet 4 hours prior to the start of the match. Registration closes 5 minutes before the match begins, so make sure that you are all ready to go.

TCO19 Points Leaderboard:


Results Div I fjzzq2002 . fjzzq2002

tourist . tourist

Petr . Petr

qwerty787788 . qwerty787788

nika . coder

Div II MysteryGuy MysteryGuy

Batrr . Batrr

ezoixx130 . ez_zh

acheing . acheing

paulinia . paulinia


Thanks to Blue.Mary aka. lucyanna2018 and misof for the editorials.

Don’t know how to compete in Topcoder SRMs?

Topcoder Java Applet — You can refer to this guide here to set up the applet. (Note that those who have Java 8 installed on their machine will see a security issue — You will have to add Topcoder in security exceptions in Java Control Panel. Please refer to the details in the guide)

Hope to see most of you competing! All the best!

Next SRM 738: September 30, 12:00 UTC-4

Read more »

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

By huawei, 32 hours ago, In English,

Dear Friends!

If you dream of realizing your ideas in new technologies and products used by a third part of the world's population — join Honorcup Marathon. It will be an unrated round for individual participation, as well as for teams of up to three people.

You will develop new method for determining blood pressure. The standard procedure for measuring blood pressure requires about a minute, during which the cuff compresses the artery in the hand. Since the procedure is relatively sophisticated, simpler methods of blood pressure estimation are potentially of great value. We suggest that you learn how to determine blood pressure based on the data from optical methods to determine changes in blood volume in the finger. You can solve the problem individually or in a team up to three people.

At stake: high paid internships in Moscow, St. Petersburg or China (including transportation & accommodation expenses if needed). Also we have 9 smartphones for top 9 results:

  • 1-3 place: Huawei P20 Pro
  • 4-6 place: Huawei P20
  • 7-9 place: Honor 10

And, of course, TOP 30 participants will get T-shirts with Honorcup Marathon logo!

We accept solutions before 4th October, 19.59.59, Msc time. Winners will be awarded on 20th of October during the opening ceremony of 1/4 ICPC 2018 in Nagatino, Msk.

We will ask winners to provide the source code and description of the solution; the details can be discussed in a phone call. In case of reasonable doubt about the violation of the rules, we reserve the right to transfer the prize to the next participant. Thank you for understanding!

Don’t miss your chance!

Good luck to all!

Read more »

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

By GreenLantern__1, history, 3 days ago, In English,

Hello Codeforces Community.

This question is for people who have been doing CP for a lot of time. Given a chance to start all over again, what advice would you give to your former self to improve faster? You can include anything from mistakes you frequently did and improved upon after a long time to topics you procrastinated studying.?

Read more »

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

By usaco_dp, history, 41 minute(s) ago, In English,

How do I find a list of all the DP and graph problems on USACO? I require them to practise for my regional olympiad, which has only DP and graph problems. Is there any one/ any way to sort all the problems by their topics?

Read more »

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

By marcosvcloures, history, 38 hours ago, In English,

Since the 2018-2019 ACM-ICPC Brazil Subregional Contest doesn't have an Official Editorial, I propose that we make an "Community Editorial".

B — Nim

We can think of every position [i, 0], [0, i], [i, i] as "insta-winning" positions. To model so, we can give them a very high Grundy number, so they doesn't conflict with any other possible Grundy number. That way, the cells that can only move you to an "insta-winning" cell, recieve an Grundy number of 0, meaning that they are losing positions.

After that, we can preprocess all possible positions and get it's Grundy number.

The final answer is just the nim-sum of every starting ball.

Accepted code

C — Sweep line

To make things easier, we can think of every cut as an straight line. First, we need to observe two things:

  • Every line splits an area into two new areas.
  • Every line intersection splits an area into two new areas.

Then, the answer must be h + v lines from the first observation  +  h * v lines from the second observation (every vertical line intersects with every horizontal line)  +  the number of intersections of lines in the same orientation.

It's easy to see that lines of the same orientation can only intersects if (starti < startj and endi > endj) or (starti > startj and endi < endj).

One fast way to count how many times the above is true is to use an sweep line (from left to right, bottom to top, etc).

Accepted code

D — Ad hoc

Just count the number of numbers ! = 1

Accepted code

E — String

Just follow the statement.

Accepted code

F — DP

We can model the problem with the following indexes: The stages that we've already seen and the current time.

Since there are at maximum 10 stages, we can store the first index in a bitmask.

Then, we can apply the following recurrence:

dp[0][0] = 0;

for(i : possibleBitmasks)
    dp[i][0] = -infinity

for(j : [1, 86400])
    for(i : possibleBitmasks)
        dp[i][j] = max(dp[i][j], dp[i][j - 1])                                    // watch nothing

        for(k : [0, number of stages - 1])
            if(i & (1 << k))                                                      // the bit k is on
                for(s : stages[k].shows)
                    if(s.endTime == j)
                        dp[i][j] = max(dp[i][j],
                                   max(dp[i][s.initTime] + s.songs,               // been on this stage before
                                       dp[i ^ (1 << k)][s.initTime] + s.songs))   // first time on this stage

But it's not fast enought :(

To fix it, "skip" to the relevant moments (aka, the end time or the start time of an show) and calculate only the values of the relevant moments.

Accepted code

I — Ad hoc

We can think of the lights as "bits" in an bitset, and the light switches as xor operations. After that, it's kinda easy to notice that we'll cicle through all possible values after 2 * M operations.

Then, we just simulate what is described in the statement (with an limit of 2 * M operations) and print the result.

Accepted code

Read more »

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

By Vovuh, history, 4 days ago, translation, In English,

1042A - Benches


1042B - Vitamins


1042C - Array Product


1042D - Petya and Array


1042E - Vasya and Magic Matrix


1042F - Leaf Sets

Solution (O(n log n))
Solution (Small to Large, O(n log^2 n))
Solution (O(n))

Read more »

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

By nemeyeth, history, 20 minutes ago, In English,


I'm just a noob as far as c# is concerned. Wrote a code, it compiles nice, I tested it and all the outputs seem fine. However, the codeforces test 1 tells me that there was an error when compiling. Any ideas?


Read more »


By achi_basadzishvili, history, 11 hours ago, In English,

Hello Codeforces, where can I write EJOI 2018 Virtual Contest ? I know that on Codeforces there was contest based on EJOI but I want to write exact contest. Please respond.

Read more »

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