Why O(n) solution gives me TLE?

Revision en2, by Loser_, 2020-05-06 08:39:23

In this problem , I take the input and I store every value in ith index to a map.If my map[i] has a value than I push both map[i] and i to a vector pair. Here in worst case the code may run in 2*n times which is so to say O(n)times.But how I am getting here TLE with O(n) times? My submission is here.

Tags c++, #std::map, pair

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English Loser_ 2020-05-06 08:39:23 4 Tiny change: 'o a vector<pair>>. Here in ' -> 'o a vector pair. Here in '
en1 English Loser_ 2020-05-06 08:37:42 441 Initial revision (published)