noob question related to std::vector
Difference between en1 and en2, changed 56 character(s)
hi all, i have two simple questions if anyone can help.↵

first, please see this submission [submission:20349642] and press the compare button. it will be compared with this submission [submission:20349625]. the code is long so don't be distracted.  ↵
what i want to know is why the first code gets AC while the second one gets Time limit exceeded on test 10. i even tested the second submission in gym and it got Time limit exceeded on test 39 (i set the time limit to 30 seconds).  ↵
i can't really see where does this huge difference come from.↵

second, there exists a huge difference between using vectors and static arrays. here, the size of the vector is fixed and i use passing with reference
 (even that the sizes of the vectors are very small 2×2). so there shouldn't be a big difference with using arrays. when i used the same code with arrays there was about 500 ms difference.  ↵
is there something to do that will make vectors faster (like using reserve function for push_back) or one simply should use arrays for a better performance?↵

thanks in advance.↵
any help is appreciated :)↵

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English fresher96 2016-09-03 02:22:29 56 (published)
en1 English fresher96 2016-09-03 02:16:53 1082 Initial revision (saved to drafts)