# Boys in the Assembly

Limits 1s, 512 MB

N boys are standing in the assembly. There is a single line only. Boys are denoted by their roll numbers. The first and second boy in the assembly line always keep quarreling with each other. So every time they do this, a teacher rotates the line. Which means, the boy who is standing at position 1 goes to the end, all other boys goes to (i-1)‘th position from i’th position.

This is a companion discussion topic for the original entry at https://toph.co/p/boys-in-the-assembly

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… asrafnabil80@gmail.com

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.
Since I needed to use my brain, you should try to use yours also.

Btw, I resubmitted the problem being inspired by you and it took 0.1s 84MB. 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!!!

1 Like

Haha… Thanks vai…

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.

@Arnob.Roy
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.

@hjr265
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