Hey,
For problem: Lauren And Inversions
My code pass all but two huge cases.
What is wrong with my approach ?
# | User | Rating |
---|---|---|
1 | tourist | 3985 |
2 | jiangly | 3814 |
3 | jqdai0815 | 3682 |
4 | Benq | 3529 |
5 | orzdevinwang | 3526 |
6 | ksun48 | 3517 |
7 | Radewoosh | 3410 |
8 | hos.lyric | 3399 |
9 | ecnerwala | 3392 |
9 | Um_nik | 3392 |
# | User | Contrib. |
---|---|---|
1 | cry | 169 |
2 | maomao90 | 162 |
2 | Um_nik | 162 |
4 | atcoder_official | 161 |
5 | djm03178 | 158 |
6 | -is-this-fft- | 157 |
7 | adamant | 155 |
8 | awoo | 154 |
8 | Dominater069 | 154 |
10 | luogu_official | 150 |
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?