Hey,
For problem: Lauren And Inversions
My code pass all but two huge cases.
What is wrong with my approach ?
№ | Пользователь | Рейтинг |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3839 |
3 | Radewoosh | 3646 |
4 | jqdai0815 | 3620 |
4 | Benq | 3620 |
6 | orzdevinwang | 3612 |
7 | Geothermal | 3569 |
7 | cnnfls_csy | 3569 |
9 | ecnerwala | 3494 |
10 | Um_nik | 3396 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | Um_nik | 164 |
2 | maomao90 | 160 |
3 | -is-this-fft- | 159 |
4 | atcoder_official | 158 |
4 | awoo | 158 |
4 | cry | 158 |
7 | adamant | 155 |
8 | nor | 154 |
9 | TheScrasse | 153 |
10 | maroonrk | 152 |
Hey,
For problem: Lauren And Inversions
My code pass all but two huge cases.
What is wrong with my approach ?
Название |
---|
It's interesting that your code passes all but two cases, since it's actually very wrong. We can feed it the following testcase:
The answer will be 4 5 (ideone), i.e. your suggestion is to swap the 4 and the 7, which will reduce the number of inversions by one. However, note that swapping the 1 and the 3 will actually reduce the number of inversions by three.
I didn't thougt it would pass either, is there a correct solution thats uses binary indexed tree ?
And this is why partial scoring like HackerRank does it is BS. How did this incorrect greedy get so many points?
4 1 2 3 7 6 5
What's the idea of incorrect greedy solution?