I am getting NZEC when I use java in codechef

I did this
https://www.codechef.com/submit/complete/24209317

I am getting NZEC

Hi
Can not open this link

To learn about NZEC run time error you can refer this link
https://www.quora.com/What-are-the-various-reasons-that-can-cause-NZEC-errors-on-online-coding-platforms

import java.util.*;
/**
*

  • @author Archit
    */
    class Codechef {
    public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    if(n>=130){
    //PigeonHole Priciple;
    System.out.println(“Yes”);
    }
    else{
    long[] a = new long[n];
    for(int i =0;i<n;i++)a[i]=sc.nextLong();
    for(int i =0;i<n;i++){
    for(int j =i+1;j<n;j++){
    for(int k =j+1;k<n;k++){
    for(int l =k+1;l<n;l++){
    if((a[i]^a[j]^a[k]^a[l])==0){
    System.out.println(“Yes”);
    return;
    }
    }
    }
    }
    }
    System.out.println(“No”);
    }
    }
    }

When I submit it through IDE mode it is showing NZEC and through non ide mode, its not why ?

put this
for(int i =0;i<n;i++)a[i]=sc.nextLong();

in your if part also ( for n>130)
if n>130 you are not taking any input, but you should take

the question you have posted code of is gray code, not holi spoj

1 Like

Thank You.
It Got Accepted now.