Are vectors slower than arrays?

Revision en3, by baibhav_21, 2022-11-09 14:44:12

I was trying out a trie problem, and I was stuck on it for a long time, I had defined the trie using a vector and every time was submitting my answer with some minor changes it showed me memory limit exceeded, or sometimes it was even giving me a TLE, After a while, I changed my vector used in the definition of the trie to the array, and in the first go itself My submission got accepted and not only that with vectors I was having a runtime of around 1762 ms and Memory of around 524300 KB and with arrays they both got optimized to 1341 ms and 366400 KB.

Can anybody pls confirm me if arrays are faster than vectors or is there is something I am missing out?

The submission that is giving me the error (using vectors)- 180171998 The submission that is giving me an ac (using arrays)- 180172097

Tags trie, vector, array, vector vs array, help, tle, memory limit

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English baibhav_21 2022-11-09 14:44:12 2
en2 English baibhav_21 2022-11-09 11:38:35 2
en1 English baibhav_21 2022-11-09 11:38:08 870 Initial revision (published)