Блог пользователя atlasworld

Автор atlasworld, история, 8 лет назад, По-английски

Hello , I was solving 510D .

Here are my two submssions : link1 , link2

why map in link1 is giving correct answer while un.map gives wrong.

the question is to choose k subsets ,to make their gcd = 1 and minimise the cost of choosing .

Any idea ! :

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
8 лет назад, скрыть # |
 
Проголосовать: нравится +15 Проголосовать: не нравится

std::map sorts key values, so while iterating them you go from less to bigger and that's what you need for this problem. However, unordered_map does not sort them and it leads to WA.