prof.PVH's blog

By prof.PVH, history, 4 weeks ago, In English,

Do you feel the breath of the coming women's day? It's time for men to share lovely code to women :) More surprisingly, today is the 19th birthday of DemiGuo (Facebook tells me that) :D

Happy women's day! Wishing all angels in the world being brighty stars and sweet roses, who inspires man to have lovely code

Read more »

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

By prof.PVH, history, 4 weeks ago, In English,

Hello Codeforces community!

Right now, my team are training hard for ACM-ICPC World Finals 2017. It's the last World Final in my life!

However, while seeing various contests at Codeforces::Gym, I am really confused of which contests are appropriate to prepare for World Finals. Except past WF (there are few such contests), others seem to be unsuitable (regional contests, except NEERC, might be easier, while Petrozavosk Training rounds turn out to be deadly). Which kinds of contest do you use for training?

Beside that, I would like to know if there are training contests. I highly appreciate Codeforces weekly Training or NAIPC. I understand that doing virtual contests are adequate, but such contests attract more teams, therefore they reflect accurately where we are in the world!

Thank you very much and see you in World Finals!

Read more »

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

By prof.PVH, history, 3 months ago, In English,

Hello Codeforces community,

I am lookding for an online judge system for training for Vietnam National Olympiad in Informatics. The system should satisfy the following conditions:

  • It supports adding problems manually.

  • It can judge the submissions according to OI style (The number of points a submission gains is directly proportional to the number of test cases it passes).

SPOJ used to be the best choice for a long period of time. However, its limitation in the number of test cases (at most 16) makes it no longer be a perfect choice. Codeforces, as far as I know, despite allowing local training, does not provide the OI judging service.

Can you give me any advice on where I should host the judging service? Writing my own server, of course, is not my expected answer.

Thank you :D

P/s: Today is Jan 11th now. Why the Christmas theme still appears on Codeforces?

Read more »

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

By prof.PVH, history, 6 months ago, In English,

Hi everyone,

I am trying to solve problems by JAVA so I want to use Chelper. Here is what I have done:

  1. Install IntelliJ IDEA 2016.2.4

  2. Install CHelper plugin

  3. Create an empty project named "Competitive programming"

  4. Change some project settings like the image below:

However, it does not work. When I click on "New task", it says "defaultDirectory should be under source and in non-default package."

Could anyone show me the way to setup CHelper? I am new to Java and IntelliJ so many things may be unclear with me.

Thank you very much for your help

Read more »

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

By prof.PVH, history, 7 months ago, In English,

UPDATE:

Official result of IOI 2016 has been published here: http://stats.ioinformatics.org/results/2016

The closing ceremony of IOI will start on 16:00 MSK. Online stream is available here: https://www.youtube.com/watch?v=BAkcby2xEwQ


Hey guys!

Hello all IOI 2016 participants!

IOI 2016 has eventually started. It's my big sadness that I can not take part in IOI this year. I am too old to do that :((

How is everything now in Kazan? I guess that Russian girls are all cute and beautiful, right? Can you share with me your feelings, funny stories and photos inside this post? I really want to hear from you, even when I feel jealous with you.

Anyway, congratulations for being here. You are all the best. Wish you sweet, amazing and memorable moments at IOI. Best luck in the contest and hope you will get high ratings. (just kidding :D)

Read more »

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

By prof.PVH, history, 12 months ago, In English,

The easy problem in SRM 685 is the N-th time I failed because of using __builtin_popcount instead of __builtin_popcountll. As a result, a new line has been added to my template code:

#define __builtin_popcount __builtin_popcountll

Btw, does anyone have an idea why C++ doesn't merge the 2 above functions into one to avoid such silly mistakes?

Read more »

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

By prof.PVH, history, 13 months ago, In English,

Happy International Women's day to all female members on Codeforces, especially delinur and DemiGuo. Wish you all beautiful, successful and receive many flowers from guys today :D

P/s: How many girls are there on Codeforces?

Read more »

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

By prof.PVH, history, 13 months ago, In English,

Where is the announcement blog for Codeforces Round #345? Why the authors are still silent? Do they want to keep it secret?

Read more »

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

By prof.PVH, 23 months ago, In English,

Hi everyone!

Today, I found some problems while trying to print a double values in C++. Below is my code:

#include<bits/stdc++.h>
using namespace std;
int main(void) {
    double x=1.0/3000;
    printf("%.7lf\n",x);
    return 0;
}

When I compile this code using command mingw32-g++.exe -O2 -Wl,--stack=268435456 -DSKY, I saw 0.0003333. However, after changed to mingw32-g++.exe -O2 -std=c++11 -Wl,--stack=268435456 -DSKY (include C++11), I saw 0.0000000.

I uss Windows 8 and my g++ version is:

C:\Program Files (x86)\CodeBlocks\MinGW\bin>"mingw32-g++.exe" --version
mingw32-g++.exe (tdm-1) 4.7.1
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Has anyone ever met this problem? What is the solution to avoid this?

I'm looking forward to your answers. Thank you :D

Read more »

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

By prof.PVH, 2 years ago, In English,

The April Fools' day (April 1st) is coming shortly. Traditionally, every year on this day there is a contest called April Fools' day contest. However, it seems that no such contests this year.

April Fools' day contest is a special interesting contest, and held only one per year. So it will be a great pity if it isn't held this year.

Read more »

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

By prof.PVH, 2 years ago, In English,

Given a non self-intersect polygon and a line. How can I calculate the total length of parts of line which are inside the polygon? I need an O(NlogN) or faster algorithm, where N is the number of vertices of polygon.

For example, below is the polygon ABCDEFGH.

With line y = 0, no parts inside the polygon.

With line y = 2, the parts inside the polygon are IJ and KL, and the total length is 2.5.

With line y = 3, the part inside the polygon is BC, which has length 1,

Image and video hosting by TinyPic

I'm looking for your answers. Thanks for your help.

Read more »

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

By prof.PVH, 2 years ago, In English,

The rockethon 2015 T-shirt is the 7th T-shirt I have won since I joined competitive programming. I'm very happy about them, as they are very nice and help me save money a lot.

However, I can't go out with shirts only. I also need some jeans. :( I can't find any contests arwarding jeans. Why don't contest organizers arward jeans instead of T-shirts? Wearing rockethon T-shirt with rockethon jean will be very interesting! :)

Read more »

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

By prof.PVH, 2 years ago, In English,

The new year has already begun in some countries (New Zealand, Australia,...) Do you feel the breathe of a coming new year?

Wishing all of you good health, great success, happiness. Hoping there will be a lot of interesting contests, and many red coders next year.

HAPPY NEW YEAR 2015!!!

Image and video hosting by TinyPic

Read more »

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

By prof.PVH, 2 years ago, In English,

Do you remember? One year ago, Codeforces Round #210 was delayed 1.5 hours because of our Codeforces admin MikeMirzayanov's daughter's birthday! Now she is 3 years old. This year, no contests seem to be moved, but I think a big party will be held.

Happy birthday to the little princess. Wishing her everything best in the world!

Image Hosted At MyspaceGens

Read more »

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

By prof.PVH, 2 years ago, In English,

In number theory, we always write a ≡ b (mod p) means that the reminder of division of a by p and the reminder of b by p are the same. Today, I have a question about this definition.

1. Same reminder of integers:

If , a ≡ b (mod p) means or . It's quite easy to see that.

2. Same reminder of rational numbers:

We also write , for example: . What do they mean?

The above definition is obviously wrong, since . But with the modular multiplicative inverse, can be written as a * b - 1 ≡ r (mod p). So, in this case, I think the definition should be: means: For every pair of integers (A, B) satisfies , we always have . Note that so we can use the definition for integers.

3. Same reminder of irrational numbers:

In the editorial of problem 446C - DZY Loves Fibonacci Numbers, the authors wrote:

Fn ≡ 276601605(691504013n - 308495997n) (mod 109 + 9)

The correctness of the last equation can be proved easily. However, to get the final equation, we need some transform like: .

My question is, how can we define equations a ≡ b (mod p), when a or b is irretional number like that, and why the above transform is correct.

I'm looking forward to hearing your responses. Thank you for your help!

P/s: I know, this blog may have something difficult to be understood, but please do not vote down it. I have thought a lot about this problem, but I can't find the answer.

Read more »

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

By prof.PVH, 2 years ago, In English,

Hello Codeforces community!

Today, I found a new function on Codeforces, it looks like the file comparing. As you can see, when you are viewing a submission details, a new button "Compare" appears:

Image Hosted At MyspaceGens If you click the button, you can choose another submission, and Codeforces will show you the difference between the current submissions and the one you chose:

Image Hosted At MyspaceGens

I think this function is useful. For example, you solved a problem long time ago, and now you forgot the solution! You look at your accepted code to see how to solve it. You have made two submissions, one correct, one incorrect. With "Compare" funcion, you can easily find the mistakes in your incorrect submission. Therefore, you can determine the reason of your mistakes (a small bug in coding, or a tricky test case).

I hope my discovery will have you a lot! Thank you for reading it.

Read more »

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

By prof.PVH, 2 years ago, In English,

Tomorrow, the next SRM will be held at 07:00 EDT. Don't miss!

Have a nice SRM. Good luck :D

Read more »

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

By prof.PVH, 3 years ago, In English,

The Round 2 of TopCoder Open 2014 Algorithm ended a few months ago. Are there any announcements about T-shirts? My best rank on Round 2 was 82, can I win a T-shirt?

Read more »

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

By prof.PVH, 3 years ago, In English,

Congratulations! worse has become the first person on Codeforces with negative rating!!!

I wonder, how many CF rounds does tourist need to have rating lower than worse :D

Read more »

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

By prof.PVH, 3 years ago, In English,

Tommorow, the SRM 632 will be held at 7:00 EDT. This is the last chance for you to use the web arena and be able to win TC prizes (a trip to TCO14 or a T-shirt!). Don't forget to use the web arena and "test your luck".

I wish you would be "lucky enough" to win prizes!he

Happy coding.

P/s: The SRM schedule of this year is fully updated.

Read more »

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

By prof.PVH, 3 years ago, In English,

Tomorrow, the last SRM in August will be held at 12:00 EDT. It's sponsored by HP — as SRM 630. Don't miss it!

Enjoy your SRM, have fun and get high rating!

UPD: Contest ended. Let's discuss problems here!

Read more »

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

By prof.PVH, 3 years ago, In English,

Tomorrow, SRM 629 will be held at 11:00 EDT. This SRM is 3 weeks after the previous one (SRM 628 was on Jul 22, my birthday :D ). 3 weeks without TopCoder (except TCO14 Round 3), I'm sure that many people and I miss TopCoder too much! A sad fact that the number of SRMs is decreasing recently. After some months with 4 SRMs each, July has only 2, August has 3, and it's still not sure about next months. I don't know the reason, but it will be a great pity if there aren't any more SRMs.

I like some SRM rules. The one I like most is that the ratings will change if we open a problem. This forces us to try our best to solve problems, or our ratings will decrease much (we can't keep our ratings unchange by not making any submissions). The next one is value of a problem starts decreasing when we open it (not from the beginning of the contests). We don't have to choose which problem to solve first, and next. I also prefer to have coding and challenging phase separately, since the cost of challenging will be reduced.

I hope there will be more SRMs in the future, as many as recent months. Wishing you a wonderful SRM and high rating. Don't forget to share your thinking about TopCoder and discuss the round problems here AFTER CONTEST ENDS.

Thank you.

Read more »

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

By prof.PVH, 3 years ago, In English,

Is there anything wrong with CF? Many submissions are in queue now.

Read more »

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

By prof.PVH, 3 years ago, In English,

Today in Codeforces Round #244 (Div. 2), I found that there were too many test cases in problems C,D,E.

Problem C and E have more than 100 tests each, and problem D has about 170 tests.

As a result, the system testing phase become very slow.

Do you think that it is necessary to create such many tests? In my opinion, having more than 100 test cases doesn't make the test stronger.

What about you? Thank you.

Read more »

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

By prof.PVH, 3 years ago, In English,

Given N distinct points on the plane. Find the pair of point with the smallest (and largest) Euclid distance between them.

I only know the Brute-Force O(n^2) algorithm to solve this.

Can someone give me any faster algorithm?

Thanks in advance.

Read more »

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