GREEDY ALGORITHM BALIFE

i am not able to pass one of the test cases from this code.
please tell my mistake
here is my code

logic and code is correct
only thing you have to done is
return when ans is not possible

if(load%n!=0)
	{
       cout<<"-1"<<endl;
	   return 0;
	}

this is because if you do not write return 0;
then it will continue executing code below
and finally print the max load
hence give wrong ans

if you have more doubts regarding this feel free to ask
i hope this helps
if yes hit a like :heart:: and don’t forgot to mark doubt as resolved :grinning:

okay i got that. thank you for help