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

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

^

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

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

I usually prove my greedy by submission. :)

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

There's one argument I use and if it doesn't work, I just believe in it :) Here's it (pretty standard):

Consider candidate to the answer x' ≠ x and where x is the one that would be chosen by greedy. Now we say that if we choose x something gets improved.

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

Use the leaderboard. If many people have wrong submissions, it might mean that the obvious-ish greedy solution is wrong. Then one should think about it more. Find a countertest or prove it. Or just stresstest against the naive solution.

I usually think for a moment about a countertest or an easy proof. It doesn't make much sense to spend a lot of time to prove something, unless the solution would take long to implement

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

I don't have enough experience to advise you but several times I've seen solutions that are solved by some weird comparators then some processing.

Usually I got a little bit surprised, and thought to myself "What sort of thinking process did this guy/team go through", only to ask them later, and know they just implemented some verifier, and tried several comparators till one passed them, submitted and AC.

This is why I usually have a strong dislike against "hard to prove but easy to guess and code" greedy problems.