ACCBIP - Editorial

Probably he did it with some script.

Hah Very Smart of you

You are not alone, tried both tabular and recursive and failed in same test case, still trying to figure out.
Tabular Approach : CodeChef: Practical coding for everyone
Recursive with memoization : CodeChef: Practical coding for everyone.

Edit:
Memoization solution with proper comments:
CodeChef: Practical coding for everyone
@infinitepro please look into this why many have got wrong answer for just one test case.

1 Like

Hey Risabh this is not related to editorial . But can you please tell me how is nit dgp for MTech CSE ?

Here’s my solution - CodeChef: Practical coding for everyone.

I don’t see how the time limit was tight. Knapsack DP is fairly straightforward.

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

Can’t guess why many have failed just one TC.

Solutions of Tester,setter and Editorialist are not visible. Please update them ASAP.

Maybe it was the only strong testcase covering all types of corner cases.

where are solutions?

Yea, it was a very lucky case.

Most tests were generated randomly, using some heuristics (K was set to near maximum, C was between 10 and 400 etc) to prevent overly weak test cases.

It’s the other way round, write an AC code and create a poem for yourself out of that XD

It’s your sort(). Try using a set or get the next_minimum for the (i+1)st loop while doing the i-th iteration.

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 :slight_smile:

@admin @rishup

This was a really good problem. Kudos to you @infinitepro

2 Likes

wonderful … c++ to english converter

there’s no such greedy selection, have you read about the knapsack problem?

You must have written some script, share it!