On D in competitive programming

Ivan Kazmenko gassa at mail.ru
Tue Jul 31 00:27:05 UTC 2018


On Monday, 30 July 2018 at 19:44:32 UTC, Steven Schveighoffer 
wrote:
> a lifetime ago, I competed using topcoder (and wrote a bunch of 
> problem sets for them too). Topcoder had a "challenge" phase, 
> where you could challenge the solutions of others.

Nice!  I just found your profile and problem sets from 2003-2004. 
  I started using TopCoder in 2005, didn't see these earlier.

> Is there anything like that in codeforces, and if so, is D an 
> advantage as a "somewhat obscure" language (i.e. competitors 
> can't always understand your code)?

Yeah, in a way.  The challenges are called "hacks", and can 
happen for the whole duration of the contest.  But to hack 
solutions for a problem, you have to first write your own 
solution to this problem, pass preliminary tests with it, and 
lock it so you can't resubmit.  The key difference is, when the 
hacked solution itself was not locked, it still can be fixed and 
resubmitted (with a score penalty), which is actually a win-win.

As for how a different language helps, well, perhaps it does.  
But, sadly, competitive programming style often goes against 
readability, to the extent the language allows it.  In that 
regard, somewhat unexpectedly, I find other languages (e.g., Java 
or Python) more readable than C++ despite the fact that I'm less 
experienced with them.  In C++, most competitive programming code 
contains a bunch of the author's exclusive #defines for the 
language shortcomings (or worse, #defines just to save typing).  
And since #defines are so flexible, everyone has their own 
version of the language, and some of the resulting code is 
straight unreadable without a deciphering effort.

Ivan Kazmenko.



More information about the Digitalmars-d-announce mailing list