How optimal is your CP setup? Click here and find it out!

Revision en16, by Wandoka, 2024-09-09 17:37:27

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 that comes to my mind. If you see something missing from the list, let me know in the comments, I will probably update my list then.

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 know how to run 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 be 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.

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
  • $$$2$$$ points: I don't need internet access to compile my code

Some people you online editors like this one. I think not being able to compile without having internet it is a pretty big deal.

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
  • $$$2$$$ points: I use syntax highlighting
  • $$$2$$$ points: I don't use syntax highlighting because it is useless for me

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 automatically coloring it 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
  • $$$1$$$ points: When I run my code I see the amount of seconds it took to run

Seeing the time your program took to run probably won't help you to

Unable to parse markup [type=CF_MATHJAX]

accurately predict whether you will get TLE or not. But being able to determine whether your solutions runs slower or faster on a max test after a fix is important.

You can see how much memory your program used.

  • $$$0$$$ points: I cannot check the amount of memory my program used
  • $$$0$$$ points: I can check how many megabytes my program used

In certain implementations it is hard to determine how many megabytes of memory your solution takes, so it sometimes useful to see that info.

You are able to see syntax mistakes in your code without running it (in other words, you are using a Language Server)

  • $$$0$$$ points: When I make a typo, my editor tells me about it straight away
  • $$$3$$$ points: I have to compile my code to see mistakes in the syntax.

If you only can see that you have made a typo only after you compiled your code, then you have to fix the mistake and then compile the program again. It wastes time

You are using a programming language, that is able to solve all of the problems in the contest you attempt

  • $$$0$$$ points: I attempted a problem in the past and failed because of my choice of programming language
  • $$$3$$$ points: The programming language I use has never failed me.

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

You have a fast way to copy and paste algorithms/data structures

  • $$$0$$$ points: I never copypaste anything / Usually I copy algorithms from the internet
  • $$$2$$$ points: I have my own library of algorithms/data structures and when I need something, I search in it and copypaste to my code
  • $$$3$$$ points: I have my own library and I have hotkeys (snippets-like) to easily paste needed algorithms into my code without leaving my editor

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.

You don't have to copy and paste your tests every time you run your program.

  • $$$0$$$ points: When I run my program, I have to paste the text in the console every time I run the program
  • $$$1$$$ point: I am able to paste 1 test once and run it multiple times
  • $$$2$$$ points: I am able to paste several tests and once and run all of them with push of 1 button, but I cannot paste tests in the console if I want to
  • $$$3$$$ points: I am able to paste several tests and once and run all of them with push of 1 button, and if I want to I can paste the tests in the console.

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. Also sometimes it is important to be able to input data line by line (when solving interactive problems for example), that is why there is a difference between $$$2$$$ and $$$3$$$ points

You have good warnings / error messages.

  • $$$0$$$ points: My warning/error messages are confusing and they don't help me at all
  • $$$1$$$ points: My warning/error messages are mostly useful, but sometimes I wish they were better
  • $$$2$$$ points: My warning/error messages are always tell me what is wrong with my program, and I don't see a way how to make it better

I use C++ and I have spent some time on adding compilation flags that enable some new warnings. I was not able to get all of the sanitizers working properly, but even the warning messages became a lot more useful. There is a cool blog on this topic.

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.

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.

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.

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.

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)

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.

Tou 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.

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.

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.

Tags personality test, setup, just for fun

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en41 English Wandoka 2024-09-11 15:45:13 0 (published)
en40 English Wandoka 2024-09-11 15:43:43 97 (saved to drafts)
ru23 Russian Wandoka 2024-09-11 10:12:24 0 (опубликовано)
en39 English Wandoka 2024-09-11 10:11:52 0 (published)
ru22 Russian Wandoka 2024-09-11 10:10:03 38
en38 English Wandoka 2024-09-11 10:09:38 38
en37 English Wandoka 2024-09-11 10:04:14 19 Tiny change: ' 4 contest](https://' -> ' 4 contest on problem A alone](https://'
en36 English Wandoka 2024-09-10 17:37:26 331
ru21 Russian Wandoka 2024-09-10 17:36:34 54
ru20 Russian Wandoka 2024-09-10 17:34:13 90
en35 English Wandoka 2024-09-10 10:29:23 2 Tiny change: '\n- **20-36)** You ar' -> '\n- **20-35)** You ar'
ru19 Russian Wandoka 2024-09-10 10:29:09 2 Мелкая правка: '\n- **20-36)** В ваше' -> '\n- **20-35)** В ваше'
en34 English Wandoka 2024-09-10 10:27:13 5
ru18 Russian Wandoka 2024-09-10 10:25:53 198
ru17 Russian Wandoka 2024-09-10 10:23:43 13
ru16 Russian Wandoka 2024-09-10 10:19:48 9
ru15 Russian Wandoka 2024-09-10 10:16:41 5
ru14 Russian Wandoka 2024-09-10 10:13:38 22
ru13 Russian Wandoka 2024-09-10 10:08:04 2 Мелкая правка: 'вые занятие (группы и' -> 'вые занятия (группы и'
ru12 Russian Wandoka 2024-09-10 10:05:47 1880
ru11 Russian Wandoka 2024-09-10 09:59:25 1787
ru10 Russian Wandoka 2024-09-10 09:48:27 2015
en33 English Wandoka 2024-09-10 09:41:49 830
ru9 Russian Wandoka 2024-09-10 09:37:40 1852
ru8 Russian Wandoka 2024-09-10 09:25:46 2132
en32 English Wandoka 2024-09-10 09:16:05 233
ru7 Russian Wandoka 2024-09-10 09:15:26 4741
en31 English Wandoka 2024-09-10 09:02:35 136
ru6 Russian Wandoka 2024-09-10 08:59:30 5802
ru5 Russian Wandoka 2024-09-09 19:53:04 852
ru4 Russian Wandoka 2024-09-09 19:46:54 3 Мелкая правка: ' из аниме из Вконтакте.' -> ' из аниме вВконтакте.'
ru3 Russian Wandoka 2024-09-09 19:46:36 190
ru2 Russian Wandoka 2024-09-09 18:58:52 1664
ru1 Russian Wandoka 2024-09-09 18:51:56 12955 Первая редакция перевода на Русский (сохранено в черновиках)
en30 English Wandoka 2024-09-09 18:50:07 199
en29 English Wandoka 2024-09-09 18:46:41 100
en28 English Wandoka 2024-09-09 18:45:28 3 Tiny change: 'ou to $100%$ accuratel' -> 'ou to $100$ % accuratel'
en27 English Wandoka 2024-09-09 18:44:59 5
en26 English Wandoka 2024-09-09 18:42:39 3 Tiny change: 'r you are $\color{green}{~1200}$ and' -> 'r you are ~ $\color{green}{1200}$ and'
en25 English Wandoka 2024-09-09 18:42:18 7
en24 English Wandoka 2024-09-09 18:41:56 5 Tiny change: 'or{green}{~1200}$ and wasti' -> 'or{green}{1200}$ ish and wasti'
en23 English Wandoka 2024-09-09 18:41:32 2 Tiny change: 'r you are ~$/color{green}{1200}$ and' -> 'r you are $/color{green}{~1200}$ and'
en22 English Wandoka 2024-09-09 18:40:30 165
en21 English Wandoka 2024-09-09 18:32:20 1 Tiny change: 'ng each on of them. ' -> 'ng each one of them. '
en20 English Wandoka 2024-09-09 18:31:41 19 Tiny change: 'one.\n\n\n\n\n' -> 'one.\n\n\n###Shameless plug\n\n\n'
en19 English Wandoka 2024-09-09 18:30:24 29
en18 English Wandoka 2024-09-09 18:28:42 986
en17 English Wandoka 2024-09-09 18:08:10 7792
en16 English Wandoka 2024-09-09 17:37:27 3121
en15 English Wandoka 2024-09-09 17:07:43 19 Tiny change: 't.\n\nYou HAVE TO able to r' -> 't.\n\nYou **have to** be able to r'
en14 English Wandoka 2024-09-09 17:07:08 20 Tiny change: ': I don't compile my code b' -> ': I don't know how to run my code b'
en13 English Wandoka 2024-09-09 17:05:47 236
en12 English Wandoka 2024-09-09 17:03:22 189
en11 English Wandoka 2024-09-09 17:01:57 4
en10 English Wandoka 2024-09-09 17:01:08 1467
en9 English Wandoka 2024-09-09 16:45:29 8
en8 English Wandoka 2024-09-09 16:45:03 655
en7 English Wandoka 2024-09-09 16:37:59 229
en6 English Wandoka 2024-09-07 18:58:40 34 Tiny change: 'g yet.\n\nYou HA' -> 'g yet.\n\n[vote] kekking\n\nYou HA'
en5 English Wandoka 2024-09-07 18:45:05 784
en4 English Wandoka 2024-09-06 21:27:05 4 Tiny change: 'point.\n\n\n\n \n\n\' -> 'point.\n\n \n\n\'
en3 English Wandoka 2024-09-06 21:21:32 1245
en2 English Wandoka 2024-09-06 21:11:44 3844
en1 English Wandoka 2024-09-06 20:38:15 3975 Initial revision (saved to drafts)