i am getting TLE for both segment tree and BIT
I think when you are so sure about your solution . You should look for some submission which are easily available on the internet . I have also solved this problem but you have coded it in java so it will difficult for me to look at your code if you need i can provide my code to you …
Wishing you a very happy new year dude
@abeyaar, in order to sort the queries, you can store the queries in a vector of pairs… if you sort a vector using the STL sort function, it gets sorted first according to the first elements in the pairs, then accordin to the second element of the pair, since this is the default definition of the comparision function of pair…
@ma5termind Happy new year to you too.
I am sure about the segment tree solution.
But if you can check the fenwick tree one , it would be great.
hey @ma5termind if you can just give me C code to sort a multi-dimensional array of queries
Then i can test my solution in C.
i want these sorted as
hey i ain’t that comfortable with C++, i have no experience with STL and all that.
So if you can give me code in C,it would be of help
dude can you modify your code to get the queries sorted by Y? And not by X as i have given above…
you just have to assign y to v*.F.F and x to v*.F.S … rest will be the same…