Tradition of using shortcuts like rep(i,n) for for(int i=0 ; i<n ; ++i) o.O

I went through many user’s solution to understand their code. One thing i noticed their,almost they all use shortcuts.

rep(i,n) for for(int i=0 ; i<n ; ++i)

mp(a,b) for make_pair(a,b)

…and so on. I really found difficult to understand and finally i quit… :smiley:
My Question : Is it good practice to give a completely different name,as its readability becomes less ?

It is a contest programming, sometimes called speed programming and the speed (minimizing the time to deliver solution) is the goal, not readability :wink:

When you get used to it rep easier, but it is a matter of taste…

2 Likes

What you say about editorials they even do the same. Does speed matters there too… :wink:

For editorial it makes sense, but there is another reason, it’s more like pseudo code instead of complete code (one can see complete code in setter’s/tester’s solution). I like to write in such cases for i in 1..10 for example…

@nadimayaz: Which of the editorials use this kind of shortcut? I don’t think it should be done.

1 Like

I meant tester/settler’s solution… :wink:
Here i guess… o.O
https://codechef_shared.s3.amazonaws.com/download/Solutions/2014/June/Tester/DIGJUMP.cpp

@nadimayaz: Yes, tester/ setter solution uses sometimes rep/forn etc loops. But ideally they are told to not use macros for “for loop”.