Shouldn’t the second and third subtask be cleared with just a Normal Knapsack solution, where we can assign values to the lines based on their count. Like if there are 3 lines of color 1, I can assign them values 1,2,3. I did this but somehow the code failed for 3rd subtask. https://www.codechef.com/viewsolution/36827810
Can you look into it? @infinitepro
Yes. Me too got the same test case wrong. https://p.ip.fi/TxpH
Could you please tell where i went wrong. It will be a great help.
I did a kind of semi-unbounded Knapsack Algorithm.
Making a vector of size ans W and calculating the best possible answer for every value.
Can someone please explain how to decide which lines to erase if we have different values of V ; I did the calculation of triangles in n^2log(n) so didnt got TLE but since I was always deleting lines with maximum no of intersections I got WA for the subtasks (except 1 and 2).The calculation of triangles also took into account the presence of parallel lines. So please explain how to do greedy selection of lines req to be erased. CodeChef: Practical coding for everyone this is my submission