×

# Strange behaviour of std::map

 0 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  m[s]=i+1;  while in the 2nd one I inserted as :  m.insert(make_pair(s,i+1));  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 :( Thanks! asked 09 Feb '16, 13:32 291●2●3●20 accept rate: 10%
 toggle preview community wiki:
Preview

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• 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:

×61
×18
×12
×2
×1
×1

question asked: 09 Feb '16, 13:32

question was seen: 366 times

last updated: 09 Feb '16, 13:32