Why do I get an NZEC?

link for the solution

can someone tell why i am getting NZEC error ?

Hello please, I am struggling with it too

package bytelandian;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;

class Bytelandian {

  Map<Long, Long> alreadyComputed = new HashMap<>();

  Long compute(Long n) {
    if (n < 12) {
      return n;
    }
    if (alreadyComputed.containsKey(n)) {
      return alreadyComputed.get(n);
    }
    Long tmp = compute(n / 2) + compute(n / 3) + compute(n / 4);
    if (tmp < n) {
      tmp = n;
    }
    alreadyComputed.put(n, tmp);
//    System.out.println(alreadyComputed + "");
    return tmp;
  }


  public static void main(String[] args) throws Exception {
    Bytelandian b1 = new Bytelandian();

    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String line;
    while (!(line = br.readLine()).equals("")) {
      System.out.println(b1.compute(Long.parseLong(line)));
    }
  }
}

example submission:

https://www.codechef.com/viewsolution/17182239

it says 4468M mem, but it seems impossible to me

please help, I would like to complete challenges, but error after error occurs when I would like to check my work

If you are using java then remove the package declaration to fix the NZEC error.

why i am getting nzec error while i am using javascript

https://www.codechef.com/viewsolution/20963272
This is solution of a question ,it is running perfectly on my laptop but giving an NZEC error on codechef.
Anyone please help.Help me in knowing my mistakes.

#include<stdio.h>
void main()
{
int i,t,X,Y,Z,x,y,z;
scanf("%d\n",&t);
scanf("%d%d%d",&X,&Y,&Z);
for(i=0;i<t;i++)
{
x=X-Y;
y=Y-Z;
z=Z-X;
if(x>y && y>z && z>x)
printf(“yes”);
else
printf(“no”);
}
}

I am getting the same error as I am using python
while taking the input only

Not a logic problem as I tested it on a file with all possible input values. Tried commenting out all algorithmic functions (just read input and print out 1). Still getting NZEC.

Found it. It didn’t like the first line: “package MISINTER;”

How do i use the map function to accept array of integers entered on the same line???

this is CHEFSQ problem

check for run time exceptions

provide link to the question also

1 Like

It might be because you have referred to out of bound index array (that ie, referring to index > len(array). I also got this error on first try :stuck_out_tongue:

It might be because you have referred to out of bound index array (that ie, referring to index > len(array). I also got this error on first try :stuck_out_tongue:

It might be because you have referred to out of bound index array (that ie, referring to index > len(array). I also got this error on first try :stuck_out_tongue:

It might be because you have referred to out of bound index array (that ie, referring to index > len(array). I also got this error on first try :stuck_out_tongue:

It might be because you have referred to out of bound index array (that ie, referring to index > len(array). I also got this error on first try :stuck_out_tongue:

It might be because you have referred to out of bound index array (that ie, referring to index > len(array). I also got this error on first try :stuck_out_tongue:

It might be because you have referred to out of bound index array (that ie, referring to index > len(array). I also got this error on first try :stuck_out_tongue: