Map related problem.

Правка en1, от RubayedMunna, 2022-01-15 16:50:51

I got a problem whenever I was solving Atcoder contest.

I have an array. I want to store index of every occurrences of every elements of the array so that whenever someone gives me two number x and k, I can show him/her the index of k th occurrence of x.

To do this, I used a map. I used the key value of map as elements of the given array and for mapped value I used a vector so that I can push back the occurrences of the elements to the vector(mapped value).

Now, the problem is I don't know how to push back indexes to the map of vector. I also faced problem whenever I tried to find k th occurrence of the element x.

If I'm wrong, please correct me.

Теги map, vector, map of vectors

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский RubayedMunna 2022-01-15 16:50:51 692 Initial revision (published)