Recently I thought a lot about optimizing my setup. I don't think it is an important aspect of cp, as it barely affects the performance, but it is fun to think about notherless.
In this blog you will be able to determine whether you have an optimal setup or not. I will list criteria and points you get for satisfying each on of them. In the end I do the breakdown for different point ranges.
I won't include things like "having a monitor" or "having internet connection", but I will be including basically everything else. This blog is mainly made for laughs, but if you are new, you will probably learn something new, even though it won't help you to increase you rating.
You can compile and run you code.
- $$$0$$$ points: I don't compile my code before submitting
- $$$10$$$ points: I compile my code before submitting
I knew I lot of school kids that never figured out how to run their code locally. I even saw some people like this in the university. And juding by 73 pages of Compilation Error submissions from the last Div 4 contest, I have seen nothing yet.
You HAVE TO able to run your code locally. Even LGM's run their $$$A$$$ solutions on the sample tests.
Your text editor does not lag / crash
- 0 points: My editor is laggy and chashes all the time
- 2 points: My editor is a bit laggy and crushes sometimes
- 4 points: My editor runs perfectly
When I was writing local contests during my school years, I constantly dealt with lags and crashes. Probably I should not have used Visual Studio on machine that could barely run it. So if you have the same issues, I think you understand why you lose points.
2 points: You can compile and run your code with no internet
- 0 points: I use an online editor and need internet access to run my code (likes:3,option1)
- 2 points: I don't need internet access to compile my code (likes:3,option2)
Some people you online editors like this one. I think not being able to compile without having internet it is a pretty big deal.
2 points: you can benefit from syntax highlighting and you use it.
- 0 points: I am not using syntax highlighting, but I would use it if I could (likes:4,option1)
- 2 points: I use syntax highlighting (likes:4,option2)
- 2 points: I don't use syntax highlighting because it is useless for me (likes:4,option3)
If you are not colorblind, or you are not used to mono blue text on a blue screen like my dad, you will probably benefit from making you code more readable by coloring it in different colors depending on the context.
You are able to see how many seconds you program took to run
- 0 points: When I run my code I don't see how much time have passed (likes:6,option1)
- 1 points: I run my code and see the amount of seconds it took to run (likes:6,option2)
If you run your code and have to count seconds in your head to check if it fits into time limit or not, you are probably doing something wrong. It is true that you still probably won't be able to accuratlly predict the time usage of the program on the codeforces server, because the specs of your computer may be different. But being able to determain whether your solutions runs faster or slower on a max test after you fix is important.
1 point: You can see how much memory your program used.
- 1 point (likes:7,option1)
- 0 points (likes:7,option2)
In certain implementations it is hard to determine how many megabytes of memory your solution takes, so it is crucial to be able to see that information without submission your solution and hoping for the best.
3 points: You are able to see mistakes you make in the syntax of your program without running it (in other words, you are using a Language Server)
- 3 points (likes:8,option1)
- 0 points (likes:8,option2)
If you only can see that you have made a typo only after you compiled your code, that you have to fix the mistake, then compile the program again. It wastes time, it is suboptimal, you get -3 points.
3 points: You are using a programming language, that is able to solve all of the problems in the contest.
- 3 points (likes:9,option1)
- 0 points (likes:9,option2)
Some tasks are impossible to solve using slower languages. Sometimes it is possible to solve a task, but you have to put extra effort to do so. I am not an expert here, so I won't list "unviable languages". But if you run into this kind of issues, I think you also understand that what you are doing is suboptimal and you get your -3 points.
2-3 points: You have a fast way to copy and paste algorithms/data structures
- 3 points (likes:10,option1)
- 2 points (likes:10,option2)
- 0 points (likes:10,option3)
If you are finding yourself implementing the same Add on a segment, sun on a segment Segment tree algorithm 3 times in a row, you are probably becoming faster and faster at implementing it. In a certain sense, it is optimal in terms of learning. But it always be slower than just coping and pasting it.
If you have to go to the internet and copy algorithms/data structures from there, you DON"T get points for this part.
If you use snippets — you can paste the needed code without leaving your editor — you get 3 points.
If you have a library on git/local machine, and you have to search for it and copy and paste it — you get 2.
If you use someone's library that you don't fully understand — you get 0.
1/2/3/4 points: you don't have to copy and paste your tests every time you run your program.
If you have to copy the same tests over and over again to test your solution, you are doing something very wrong: it wastes a lot of time, you get 0 points.
If you are able to copy the test once and run it several times, you get 1 point.
If you can paste several tests at once and run it simultaniosly and easily add new ones, but you cannot run with terminal input (it is sometimes needed for interactive problems) — you get 2 points.
If you can do all of the things above AND also have an option of pasting your input in a terminal — you get 3 points.
There are tools like this one that allow you to copy tests from the tasks. If you don't manually copy all of the tests and use parcers like this, you get 1 extra point.
1-3 points: you have good warnings/ error messages.
If warning/error messages never help you to figure out what is the problem, you get 0 points.
You can decide how happy are you with your warning/error messages and award yourself from 1 to 3 points based on that.
2 points: Your code is readable and hackable.
Hacks exist, it is always better to get hacked (unless it is some anti-hash hack) than to FST. If your code is hard to read (aka you have a big unreadable template) you get 0 points: no one with bother to hack you.
2 points: You are able to run a debugger (in a form that is easy to use).
Even if you are not usually using a debugger, the option to be able to is definitely a plus. If you have to copy your solution to the IDE to use a debugger, or you only have an option to run the gdb in console that you never use, you get 0 points.
1/2/5 points: You have a good way to print() to debug
If you are using just cout << or print, you are probably doing something suboptimal. Being able to debug the variables with the names, being able to easily output the graph or a matrix — goes a long way.
You get from 1 point if you have basic debug functions — like being able to output the name of the variable.
You get 2 points if you can also easily get rid of debug output without deleting every print line 1 by 1
You get 5 points if you can print out in a easily readable forms graphs / data stuctures.
2/4/5 points: you have a stress testing setup.
Being able to stress test your solutions is crucial. It is impossible to find some bugs manually as fast as computer can.
You get 2 points if you have functions in your template that help you to stress test
You get 4 points if you have a bash script that you can run to compare the outputs of your solutions.
You get 5 points if you also have a script that can check whether the output is "valid or not" (for constructive problems)
2 points: you are using vim motions/ other advanced text editor key bindings.
Repeatedly grabbing your mouse to select text is definitely suboptimal. Using arrow keys to travers though code is very slow. Using things like vim motions will speed things up a lot.
2 points: you have >= 30 WPM while typing.
I know that it is not a setup thing, but it is kind`` of a similar thing. If you are typing really slow, it can take you a long time to implement a big solution, having at least some speed is important. You can check your typing speed here. The faster you type — the better, but I don't think it makes a big difference. But if you are typing really slowly, you might not be able just to type all of the problems in time.
1 point: You can easily use multiple files to code
Imagine this situation: you have been writing problem D for 30 minutes. You got stuck and decided to look at the statement of E. You instantly understand what the problem is about and want to start coding it right away. But you don't want to lose your solution to problem D. The normal way would be to open a new file, name it problem E and code there. But if your setup allows you to have only 1 active coding window, and you have to copy your solutions somewhere to save them — you are being suboptimal and you get -1 point.
1 point: You are using a class for modular operations
If your code looks like this you are doing something wrong.
d = ((a+b)%mod - c + mod)%mod * e % mod
Instead of writing mod everywhere, you can does it for you. So you can write code like this
d = (a+b-c)*e
If you don't do that, you lose 1 point.