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

Автор mac_n_cheese_pog, история, 3 года назад, По-английски

https://codeforces.net/contest/810/problem/B see this problem and see my code https://pastebin.com/U3p3vCwD

my approach: i make pair,find maximum v[i].first and then check if second is >0 then multiply it.

if u dont understand my code just try to analyze my code.i think its pretty straightforward.

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

»
3 года назад, # |
  Проголосовать: нравится +6 Проголосовать: не нравится

most of the times, greedy algorithms that comes to our mind are wrong and there is nothing wrong in that but with practice intuition improves. I read this in a book. :/

»
3 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

How do you even know that it's wrong if you still haven't submitted your solution to codeforces judge? Do you maybe get a wrong answer for the examples given in the problem statement? There are some explanations about the examples in the Note section.

Also how do you know that it's "greedy"? Is your account configured to show tags for unsolved problems? This information is a major spoiler and generally makes practice much less efficient.