I think it would be some help to those who not been accepted.

```
class Solution {
public:
vector<int> twoSum(vector<int> &numbers, int target) {
map<int, int> mymap;
// inset to map
for (int i = 0; i < numbers.size(); ++i) {
mymap[numbers[i]] = i+1;
}
vector<int> result;
for (int i = 0; i < numbers.size(); ++i) {
int a = numbers[i];
int b = target - a;
map<int, int>::iterator map_it = mymap.begin();
map_it = mymap.find(b);
if (map_it != mymap.end()) {
// find the right answer
int index1 = i+1;
int index2 = map_it->second;
// make sure the answer in the right order
if (index1 < index2) {
result.push_back(index1);
result.push_back(index2);
} else if(index1 > index2) {
result.push_back(index2);
result.push_back(index2);
} else {
// this is an except.
// because all the numbers are different,
// and the answer is a pair of different
// index not the same one.
continue;
}
break;
}
}
return result;
}
};
```