C++ STL not encouraged???

From what I have seen,coders in programming challenges like these hardly go with STL or the higher level libraries,
Yes ,the reason is speed.But aren’t we supposed to use it when the need arises??
Say if you think a problem can be solved with STL sets only. Do I avoid using STL and stick with stdio ,arrays and the likes or implement it??

It’s a trivial question but I just need to know when to use what.

If you need to use STL sets to solve a problem, then use it. It hardly makes a difference whether you use C-style code(arrays, char strings) or C++ STL code(vectors, strings, sets, maps) to solve a problem.

The only thing you need to watch out for is the speed difference between printf/scanf and cout/cin (synchronised) when dealing with large inputs.

1 Like

OK. Am aware of the C-style input functions advantage when dealing with large inputs.Its also better to avoid vectors as far as I know.
Thanks

There’s almost no performance difference between vectors and arrays*.

*http://stackoverflow.com/questions/381621/using-arrays-or-stdvectors-in-c-whats-the-performance-gap

1 Like

This is not direct answer to your question, but

you are responsible for language you choose

and in wider context that means that you are also responsible for classes/functions you want to use.

Typically this is not a problem, but for example at CodeForces there are special test casess that tests problematic implementations in Java - Arrays.sort() sorts in 0(N^2) for primitive types and there is also problem when you use HashSet/HashMap (too many hash conflicts), in both cases you will get TLE.

My opinion is, that it’s kind of unfair (especially because I do not know if there are such problems in STL) but I just wanted to warn you…