Hey,
For problem: Lauren And Inversions
My code pass all but two huge cases.
What is wrong with my approach ?
№ | Пользователь | Рейтинг |
---|---|---|
1 | tourist | 3856 |
2 | jiangly | 3747 |
3 | orzdevinwang | 3706 |
4 | jqdai0815 | 3682 |
5 | ksun48 | 3591 |
6 | gamegame | 3477 |
7 | Benq | 3468 |
8 | Radewoosh | 3462 |
9 | ecnerwala | 3451 |
10 | heuristica | 3431 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | cry | 168 |
2 | -is-this-fft- | 162 |
3 | Dominater069 | 160 |
4 | Um_nik | 159 |
5 | atcoder_official | 156 |
6 | djm03178 | 153 |
6 | adamant | 153 |
8 | luogu_official | 149 |
9 | awoo | 148 |
10 | TheScrasse | 146 |
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?