### johnchen902's blog

By johnchen902, history, 10 months ago, ,

Disclaimer: I'm a curious student from National Taiwan University.

Reference: https://algorithmics.comp.nus.edu.sg/

According to the first section, 3body2 (sidhant, btzy, bayweiheng) will go to ICPC World Finals 2019.

However, according to the published rule in ICPC Selection Contest For Regionals 2018 section, Send Bobs to Alice (alexa0704, MofK, Tran Tan Phat) should go instead.

Anyone know the story?

### Details

According to the blog of C. J. Hwang., NUS have 3 qualified teams: Send Bobs to Alice, 3body2, and Pandamiao. The NUS rule said the team with lowest score wins, where score is (NUS rank of Singapore Preliminary-1)*1.1 + (NUS rank of Jakarta/Nakhon Pathom/Yangon-1)*2 + (NUS rank of Singapore-1)*2.9. Here are the scoreboards:

The NUS ranks:

• Send Bobs to Alice: 2nd in Singapore preliminary, 2nd in Nakhon Pathom, 1st in Singapore
• 3body2: 4th in Singapore preliminary, 1st in Yangon, 2nd in Singapore
• Pandamiao: 3rd in Singapore preliminary, 1st in Nakhon Pathom, 5th in Singapore

Accordingly, the scores are:

• Send Bobs to Alice: (2-1)*1.1 + (2-1) * 2 + (1-1) * 2.9 = 3.1
• 3body2: (4-1)*1.1 + (1-1) * 2 + (2-1) * 2.9 = 6.2
• Pandamiao: (3-1)*1.1 + (1-1) * 2 + (5-1) * 2.9 = 13.8

Therefore, Send Bobs to Alice has the lowest score and should go to World Finals.

• +29

By johnchen902, history, 3 years ago, ,

Today I learned that NaNs and infinites may slow down programs significantly. So instead of

// some computation that produce NaN when arg == 0
if(arg == 0) // special case
result = 0;


one should write

if(arg == 0)
result = 0; // special case
else
// some computation that produce NaN when arg == 0


Compare submission 19257027 and 19257693 and you'll see.

• +61

By johnchen902, 5 years ago, ,

I ran across this problem several months ago, but I can't think up with an algorithm fast enough:

You're given a string S (|S| <= 500000) consisting of '(', ')' and '?', where '?' can (and must) be changed to either ( or ).

If the ith question mark is changed to '(', you'll get a penalty of L[i] (L[i] is in the range of int).

If the ith question mark is changed to ')', you'll get a penalty of R[i] (R[i] is in the range of int).

Given S, L and R, is it possible to produce a valid (matching) parentheses sequence? And if yes, what is minimum penalty you must pay?

• +17

By johnchen902, 5 years ago, ,

I wonder what happened behind the scene during "pending system testing". It always takes so long...

• +29

By johnchen902, 5 years ago, ,

I received the following message right after registering for Codeforces Round #259 (Div. 1). This guy is obviously trying to cheat. What should I do?

Edit:

He angered me and I decided to reveal his name: mahdi123. I think he should be banned.

• +122