Ad
  • Default User Avatar

    in the for-loop, no need to check whether wariors actually contains c; wariors[c] == 0 if c is not in wariors (actually the first time it is added with default value 0)

  • Default User Avatar

    In your for-loop you are searching in your map twice. The first time when you call find and the second time when you call at. You can improve your performance by using search->second instead of warriors.at(c).