Modified for testing the scenario where the maximum required resources is up to 10