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

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

how can i prove my solution both Dp and greedy.

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

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

see if it gets AC or WA

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

    he is probably asking this so that he can know if his solution is correct before submitting. Basically if he can write a valid proof for his algorithm, then he can be sure that he won't get penalty for incorrect submission during contests.

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

ask your mom

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

Proving that your solution is correct is a valuable skill to a competitive programmer. For dp, proof by induction is usually useful. For greedy solutions you could use another type of proof (direct proof or by contradiction) or proof by accepted if you're bad at proving things.

Spoiler