[Community Puzzle] Simple Load Balancing

Coding Games and Programming Challenges to Code Better

Send your feedback or ask for help here!

Created by @BleedingWithin,validated by @Sasso_Stark and @FredericLocquet.
If you have any issues, feel free to ping them.

Hello, how can I more optimize my code to succed last test pls ?

I’m in c# and I used several function with list like .min and .InstanceOf to find the min more faster but it’s not enough
I can show my code if you want.

Guess i am a bit late.

However, if you tried a solution searching for the min in the vector and adding +1 to it, it will run k times, k being the number of tasks to distribute, and this number can be very high.

Maybe some tricks could help your solution work for big k tests, but i suggest to you to find “shortcuts” in the task distribution to avoid doing k runs of your code :slight_smile:

Aaargh! What is Validator 4? :rofl: I think I have a pretty good load balancing algorithm, and I pass all testcases, but I can’t get past Validator 4. Any hints?

Sorry, we can’t give out validators like this :slight_smile:
Maybe tell us what are the steps of your algorithm and we will try to help.

P.S.: i suspect a timeout in your solution, because validator 4 has the highest number of servers

1 Like

I created script in python3. In IDE validator 4 did not pass. I gave up to provide better solution and decided to submit code. Then, it turned out all tests passed and I got 100%.

My solution makes use of dictionary holding information how many executors runs 0, 1 … num of jobs. So, in first scenario I create dictionary {0: 1, 1: 1, 2: 1, 3: 0, 4:0, 5:1}.
I do not do any sorting, just O(1) dictionary operations and additions.

After realizing, I can’t just run it k times it really became a challenge.
I figured it out though. (The only one in GoLang, that has shared the code so far :rofl:)

I basically did, what you would do, if you would run those kind of tasks by hand.
Only had to sort the vector once at the beginning and turned the number of loops down to around .02k in the final Test.

Thank you to the creators.

1 Like