Hey,
For problem: Lauren And Inversions
My code pass all but two huge cases.
What is wrong with my approach ?
# | User | Rating |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3823 |
3 | Benq | 3738 |
4 | Radewoosh | 3633 |
5 | jqdai0815 | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | ksun48 | 3390 |
10 | gamegame | 3386 |
# | User | Contrib. |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
2 | maomao90 | 163 |
4 | atcoder_official | 161 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 157 |
8 | TheScrasse | 154 |
9 | nor | 153 |
9 | Dominater069 | 153 |
Hey,
For problem: Lauren And Inversions
My code pass all but two huge cases.
What is wrong with my approach ?
Name |
---|
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?