Boys in the Assembly

N boys are standing in the assembly. There is a single line only. Boys are denoted by their roll num…

Click here to read the complete problem statement.

If you need help solving this problem, mention your approach and ask specific questions. Please avoid sharing your code and asking the Community to figure out “what’s wrong”.

As we can use Pyhon, so I think the time limit should be increased for python programs. Please think about it.

This submission didn’t get CLE because of using Python. You need to figure out the optimal solution to this problem. A naive approach here will result in this regardless of the programming language.

@Nabil62245 I have solved this problem using python perfectly.
Brute force like approach will not work here.
Try to find a more efficient way to solve the problem.

Can you please send me the code…

let’s say it in @hjr265 style.

Of course, I can send you the code. However, If I do, you will lose the pleasure of solving a problem.

Thus, you should try to solve it yourself.

1 Like

It’s OK. Maybe I’ll learn something new. Send me…

Make test cases and try to figure it out yourself. :yum:
Since I needed to use my brain, you should try to use yours also. :cowboy_hat_face:

Btw, I resubmitted the problem being inspired by you and it took 0.1s 84MB. :sunglasses: The previous had taken 0.2s 125MB. And both are written in Python3.

And I think it is a bad example to share solutions here.

So, I think, there are always scoops of finding more optimal solutions.

Good Luck!!! :wink:

1 Like

:laughing::laughing::laughing: Haha… Thanks vai…:heart:

I can’t figure out where the problem of my program is. I passed every single test case except for the last one. They say it’s exceeded CPU limit. My RAM is okay at 84 MB. But what can I do to make my program go faster? PLEASE HELP!

Click on Shortest button on the right side of the problem page under Statistics.

I have seen your latest submission.

A brute force like approach is likely to get a CPU Limit Exceeded verdict for this problem even if you use faster languages like C / C++ / Pascal. The test cases are very big so you will most likely get succeed if you calculate the odds mathematically.

So, try to find a better way to solve the problem and avoid looping.

I think adding the Queue tag here will only confuse people.
You should remove it.

@touhidur I will look into this. But please use the “Suggest Tags” feature to suggest changes like these.

1 Like

i can’t understand the problem…can anyone explain?

Maybe you are using brute force also. Rethink the solution.

1 Like