^
^
| № | Пользователь | Рейтинг |
|---|---|---|
| 1 | Benq | 3676 |
| 2 | jiangly | 3670 |
| 3 | Kevin114514 | 3657 |
| 4 | maroonrk | 3355 |
| 5 | Um_nik | 3353 |
| 6 | squareOf105 | 3346 |
| 7 | tourist | 3343 |
| 8 | strapple | 3324 |
| 9 | heuristica | 3322 |
| 10 | jiangbowen | 3291 |
| Страны | Города | Организации | Всё → |
| № | Пользователь | Вклад |
|---|---|---|
| 1 | Qingyu | 158 |
| 2 | nik_exists | 150 |
| 2 | maspy | 150 |
| 4 | AmShZ | 143 |
| 5 | Um_nik | 141 |
| 6 | Errichto | 139 |
| 7 | adamant | 137 |
| 8 | BledDest | 134 |
| 9 | maroonrk | 133 |
| 10 | qwexd | 130 |
| Название |
|---|



I usually prove my greedy by submission. :)
Proof by Accepted :"D
but what if there are weak tests?
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.
Proof by contradiction. Can you share some of your favorite greedy problems, I need to improve my problem solving on greedy problems :)
You can use A2oj and select "Greedy" category in that.Or just google "Greedy problems codeforces".
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
I used the leaderboard in the last contest for the clique problem (Div. 2 E — Div. 1 C Party) and the code passed the pretests. As it turned out, the pretests were just very weak and hundreds of greedy submissions including mine got Wrong answer on test 51 :(
mehh, just call it a bad day , this trick is mostly godlike , especially to people like me :)
I was thinking about contests with full feedback, but it's often the same for CF — as long as pretests aren't weak.
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.