RAD's blog

By RAD2 months ago, translation, In English

Initially the order of problems was A-C-E-D-B. But we were not sure about last two.

166A - Rank List

This is simple straight-forward problem — you were asked to sort the teams with the following comparator: (p1 > p2) or (p1 = p2 and t1 < t2). After that you can split the teams into groups with equal results and find the group which shares the k-th place. Many coders for some reason used wrong comparator: they sorted teams with equal number of problems by descending of time. Such submits accidentally passed pretests but get WA #13.

166B - Polygons

Polygon A is convex, so it is sufficient to check only that every vertex of polygon B is strictly inside polygon A. In theory the simplest solution is building common convex hull of both polygons. You need to check that no vertex of polygon B belongs to this hull. But there is a tricky detail: if there are many points lying on the same side of convex hull than your convex hull must contain all these points as vertices. So this solution is harder to implement and has some corner case.

Another solution: cut polygon A into triangles (by vertex numbers): (1, 2, 3), (1, 3, 4), (1, 4, 5), …, (1, n - 1, n). The sequences of angles 2 - 1 - 3, 2 - 1 - 4, 2 - 1 - 5, …, 2 - 1 - n is increasing. It means that you can find for each vertex of B to which triangle of A it can belong using binsearch by angle.

Similarly you can cut polygon A into trapezoids (with vertical cuts). In this case you’ll need a binsearch by x-coordinate.

166C - Median

If the initial array doesn’t contain number x, than you definitely need to add it (that’s +1 to answer). Than do the following. While median is strictly less than x you need to increase it. Obviously the surest way to increase the median is to add a maximal possible number (105). Similarly while the median is strictly more than x, add a number 1 to the array. Constraints are small, so you can add the numbers one by one and recalculate the median after every addition.

Also there is a solution without any cases: while the median isn’t equal to x, just add one more number x to array.

166D - Shoe Store

Let’s sort the people by decreasing of shoes size. Observe that when considering the i-th man we are interested in no more than 2 pairs of shoes: with size li and li + 1. It allows solving with dynamics. The state will be (the number of first unconsidered man i, is pair of shoes with size li available, is pair of shoes with size li + 1 available). You have 3 options: leave the i-th man without shoes or sell him a pair of shoes of one of suitable size (if available).

166E - Tetrahedron

Obvious solution with dynamics: you need to know only how many moves are left and where is the ant. This is 4n states, each with 3 options – most of such solution passes. Observe that the vertices A, B, C are equivalent. This allows writing such solution:

int zD = 1;
int zABC = 0;
for (int i = 1; i <= n; i++) {
	int nzD = zABC * 3LL % MOD;
	int nzABC = (zABC * 2LL + zD) % MOD;
	zD = nzD;
	zABC = nzABC;
}
cout << zD;

Also this problem could be solved by log(n) with binary exponentiation of some 2 × 2 matrix into power n.

Read more »

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

By RAD6 months ago, translation, In English
Hi

Unfortunately, Codeforces Beta Round #93 is rescheduled for tomorrow because of circumstances beyond our control. The new time is November, 9, 21:00 Moscow time (exactly 24 hours ahead).

We apologize for any inconvenience.
 
See you tomorrow,

Read more »

 
 
 
 
  • Vote: I like it  
  • -59
  • Vote: I do not like it  

By RAD15 months ago, translation, In English

While the world community of participants of programming contests is waiting with bated breath for the news about new date and place of the Final, we decided not to delay the next round and prepared some problems on the train from Petrozavodsk to Saratov. In preparation were involved Mike Mirzayanov, Artem Rakhov and Max Ivanov. Tasks were translated into English by Maria Belova.

Good luck!

Artem Rakhov and Codeforces team 

Read more »

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

By RAD16 months ago, translation, In English
Good evening! 

I am glad to invite you to participate in Codeforces Beta Round #52 (Div. 2). Today's round was prepared Michael Mirzayanov, Max Ivanov and Maria Belov. 

It's possible that "out of the competition"-participants will not be able to use the tab "hacks". Do not panic, on the next Div. 2 Round we will necessarily fix it. 

Good luck!
Artem Rakhov and Codeforces team

Read more »

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

By RAD16 months ago, translation, In English

Hi everyone!

The recent testing round went well. It is expected that everything will run faster. Today's round was prepared by: Mike Mirzayanov, Nickolay Kuznetsov, Ivan Fefer and Maria Belova.

Good luck!

Artem Rakhov and Codeforces team

Read more »

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

By RAD17 months ago, translation, In English

Good evening!

Soon many of you will have your examinations, and someone even have it now. I wish you excellent marks and many easy exams!

Thanks to Nickolay Kuznetsov, Gerald Agapov and Ivan Fefer for their help in preparation of the round.

Good luck!

Artem Rakhov and Codeforces team


UPD:

Ratings will be updated later

Read more »

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

By RAD18 months ago, translation, In English
Good evening

Yesterday evening the Saratov university delegation returned from St. Petersburg, from the ACM-ICPC NEERC 2010/11 World Programming Championship semi-finals. If you haven't seen the final standings: 4 Saratov teams received diplomas, and we (Saratov SU 2) advanced to the finals. Saratov SU 1 was also among those, who advanced, that's pretty cool for their first time, but didn't advance because of the limitation "only one team from one university".

Also we have prepared a Div. 2 round. Thanks for prompt assistance to Edvard Davtyan, Gerald Agapov and Maria Belova.

Good luck!
Artem Rakhov and Codeforces team


Unfortunately, the discrepancy between author’s solution and statement of problem E was detected. We bring our apologies to all the participants. All solutions that have not been Accepted previously were rejudged. Thanks to member xcr for detection of the issue.

Read more »

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

By RAD20 months ago, translation, In English

Attention, participants from the Division 1! As a test feature, you can participate in Codeforces Beta Round #32 "out of competition".


Everybody knows, that the 2nd of October - birthday of Mohandas Gandhi. We dedicate today's round to him, and many other great people who were born on October 2 :)


Round was prepared by Mike Mirzayanov, Matov Dmitry and Max Ivanov.

Special thanks to Julia Satushina for translation of statements.

Good luck!


Artem Rakhov and Codeforces team

UPD:

Read more »

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

By RAD20 months ago, translation, In English
Hello everyone on Codeforces Beta Round 31 (Div. 2, Codeforces format)

Round was prepared by: Mike Mirzayanov, Dmitry Matov, Max Ivanov and me.

Good luck!
Artem Rakhov and Codeforces team

Read more »

 
 
 
 
  • Vote: I like it  
  • -3
  • Vote: I do not like it  

By RAD20 months ago, translation, In English
Today in Russia it's not just the 20th of september, it's Recruiter's Day. In Azerbaijan – Oil Industry Worker's Day, and in Belarus – Customs Officer's Day. But for us it's another good day to arrange the round. Welcome to Codeforces Beta Round #29 (Div. 2, Codeforces format)!

Helped with preparation of the round: Mike MirzayanovDmitry MatovGerald Agapov and Nickolay Kuznetsov, thank them for that.

Happy Recruiter's Day,
Artem Rakhov

Read more »

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

By RAD20 months ago, translation, In English

Let's divide all trucks into the classes by l + r + c. It can be seen, that all the trucks that can be included in the answer are in the same class.

Let's solve the problem separately for each class. Consider all trucks from same class in the order they appear, and keep the following value: z[k] = the maximum sum that you can get, if the last taken truck has ri = k. Consider the truck number i - there are 2 options to update z:

It can update z[ri] with z[ri + ci] + vi, i. e. continue the motorcade, which has last truck with r = ri + ci. (For neighboring trucks should be true the following: rprev  =  ri  +  ci)

If li = 0, it can update z[ri] with vi, i. e. became the first truck in the new motorcade. (For the first truck should be true the following: li = 0)

The answer will be in z[0].

To restore the trucks included in the answer, we can keep with the maximal sum in z the index of last truck that updated this sum. Also we store the ancestor p for each truck that updated something in z. This ancestor is calculated when we consider i-th truck and doesn't change further: p[i] = -1 if truck i became beginning of the motorcade, otherwise p[i] = last truck that updated z[ri  +  ci].

We start restore of the answer from last truck updated z[0]. After that we restore everything using only p.

Read more »

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

By RAD20 months ago, translation, In English
We want to congratulate you with a happy new school year with this contest. We wish you excellent marks, easy exams and many Accepted in the contests. Let this year bring you many new and interesting knowledge!

Artem Rakhov and Codeforces team 

P. S. Note that the round will be held on the Codeforces Format Rules. Read the rules before the competition. Good luck!

Read more »

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

By RAD22 months ago, translation, In English

Welcome to Codeforces Beta Round #25 (Div. 2)


Authors of today's round problems are Mike Mirzayanov and me. I want to thank to Dmitry Levshunov for technical assistance in organizing the contest, as well as Gerald Agapov and Nikolay Kuznetsov for writing alternative solutions.


I wish you all good luck!


UPD: The contest is over, thank you to everyone for participating.

Read more »

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

By RAD22 months ago, translation, In English
Hi everybody

Today the author of the majority of problems is Dmitry Zhukov, many thanks to him for this. 
Also I want to thank Mike Mirzayanov for choosing problems for the contest and organizing it and Julia Satushina for the translation of the statements.

Good luck!

UPD:

Read more »

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

By RAD23 months ago, translation, In English

Welcome all to Codeforces Beta Round #22

Note that at this time registration is possible during the round. The contest will begin at 19:00 MSK.

Today I am an author of the problems. I would like to thank Mike Mirzayanov for help in contest preparations, Edvard Davtyan and Nickolay Kuznetsov for writing the verification solutions, and Julia Satushina for translating statements into English.

Good luck on the contest!

UPD: The contest is over. Thank you all for participating!
Problems
Results
Winner Kasparyanm_Mihail gains +203 to rating after the contest!

Read more »

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

By RAD23 months ago, translation, In English

Welcome to Codeforces Beta Round #18

Authors of today's contest are Mike Mirzayanov, Edvard Davtyan and me. Thanks to Dmitry Matov for his help in statements preparation and Julia Satushina for translation of problems in English.

Good luck everyone!

Read more »

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

By RAD2 years ago, translation, In English

Good afternoon.

Today I am the author of problems. I want to thank the creator of Codeforces Mike Mirzayanov and Edvard Davtyan for assistance in the problems preparation and Julia Satushina for great translations into English.

I wish everyone advance to the first division!
Artem Rakhov

UPD: The contest is over, thank you all for participating!

Read more »

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