Are pairs much faster than vectors (C++)?

Revision en1, by ShivanshJ, 2022-12-30 15:43:39

So, I was doing this this problem and noticed the drastic difference between std::pair and std::vector in C++. I preferred to use std::vector over pairs as I don't have to write .first and .second every time.

Submission using std::vector (GETS TLE) View

Submission using std::pair (GETS AC easily) View

What could be the reason behind it?

Tags #tle, #vectors, #pairs

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English ShivanshJ 2022-12-30 15:43:39 575 Initial revision (published)