You are not logged in. Please login at to post your questions!


Strange behaviour of std::map

Why does this submission pass while this one fails ?

The only difference in the codes is that in the correct submission I inserted in the map as


while in the 2nd one I inserted as :


and similarly for finding the index in the correct submission I used

            B[i] = m[s];

and in the incorrect submission I used :

            B[i] = m.find(s)->S;

So what is the cause of WA ? It has made me curious since quite a few days :(

asked 09 Feb '16, 13:32

h1ashdr%40gon's gravatar image

accept rate: 10%

toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:


question asked: 09 Feb '16, 13:32

question was seen: 366 times

last updated: 09 Feb '16, 13:32