Please subscribe to the official Codeforces channel in Telegram via the link https://t.me/codeforces_official. ×

I_love_Codechef's blog

By I_love_Codechef, history, 3 years ago, In Russian

Всем привет! Сегодня я столкнулся с ошибкой при использований map в C++.

Мой код который получил WA 1 имел строку: cost[x] = (cost.find(x) == cost.end() ? c : min(cost[x], c));
Я этот код переписал через if и получил AC: if(cost.find(x) == cost.end())cost[x] = c; else cost[x] = min(cost[x], c);

Может кто нибудь обьяснить почему так получился?

  • Vote: I like it
  • +34
  • Vote: I do not like it