Try the single-house case again. What it looks like to me is that you're
making small updates to your code, trying to fix particular cases. Instead,
take a deep breath, step back, and look at the whole thing.
*What was the problem before?*
findSol wasn't always returning something.
*How can we
Hi everyone I'm really new here and I gave a try for the first problem of
Kickstart 2020.
I get WA, but when I give my tests set, it gives good answers, here is my
code:
public class Ej1
{
public static void main(String[] args)
{
int t,n,b,value,n_casas;
Scanner
The code is for kickstart2020 round A plates.
I cannot pass the test set 2 with "TLE". Can anyone figure out why that
happens?
Thank you very much in advance.
T=int(input())
for i in range(T):
N,K,P=[int(s) for s in input().split(" ")]
beauty=[[int(s) for s in input().split(" ")]
You can change the following code
*if len(arr) == 1 and sum(arr) <= budget:*
*return 1*
to
*if sum(arr) <= budget:*
*return len(arr)*
This is because the loop below assume the sum of the array is greater than
*budget *at some point
so you need to handle the case where the sum of the
Is it WA, or RE? I'd guess RE given that your class is named something
other than Solution, and this appears to be a Java solution.
On Wed, Mar 25, 2020 at 5:10 PM FonsoGV 5 wrote:
> Hi everyone I'm really new here and I gave a try for the first problem of
> Kickstart 2020.
> I get WA, but when
*for pp in range(1,P+1): *
can be optimized to
*for pp in range(1,min(P, (nn+1)*K)+1):*
This should allow your code to pass the test set 2
--
You received this message because you are subscribed to the Google Groups
"Google Code Jam" group.
To unsubscribe from this group and stop receiving
A couple of feedback:
1. Most of the time you shouldn't need to implement sorting yourself.
You should take advantage of the sorting library that comes with your
languages/platform for free
In this case, you should sort the array using Arrays.sort() in Java
2. In contadorCasas(),
Thanks a Lot <3 <3 Actually single House was returning NONE, and also it
had some problems with house list like [25,25] with a budget of 50. I fixed
them, but still it gets WA. Ohh..gosh !
def findSol(arr, budget):
if len(arr) == 1 and sum(arr) <= budget:
return 1
arr.sort()