class Solution {
public:
vector<int> twoSum(vector<int>& nums, int target) {
map<int,int>p;
vector<int>ret;
for(int i=0;i<nums.size();i++)
{
p[nums[i]]=i;
}
for(int i=0;i<nums.size();i++)
{
int temp=target-nums[i];
if(p.count(temp) && p[temp]!=i)
{
ret.push_back(i);
ret.push_back(p[temp]);
break;
}
}
return ret;
}
};