Hi there ,
I was trying to solve this problem , when i ran the solution on my pc using IntelliJ ide it worked just fine , but when i submit the solution on codechef , it gives NZEC error.
Please help me out , i am new here.
Below is the code :
import java.io.*; public class testt { public static void main(String[] args)throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int ntest = Integer.parseInt(br.readLine()); int ae[] = new int[ntest]; for (int x = 0; x < ntest; x++) ae[x] = xyz(); for (int y = 0; y < ntest; y++) { if (ae[y] == 0) System.out.println("no"); else System.out.println("yes"); } } public static int xyz()throws IOException { BufferedReader br1 = new BufferedReader(new InputStreamReader(System.in)); String str=br1.readLine(); String ar[]=str.split(" "); int N=Integer.parseInt(ar[0]); int S=Integer.parseInt(ar[1]); String str2 = br1.readLine(); String ar2[]=str2.split(" "); int ar21[]=new int[ar2.length]; for(int y=0;y<ar2.length;y++) ar21[y]=Integer.parseInt(ar2[y]); int c=0; String str23 = br1.readLine(); String ar23[]=str23.split(" "); int ar213[]=new int[ar2.length]; for(int y=0;y<ar23.length;y++) ar213[y]=Integer.parseInt(ar23[y]); for(int zz=0;zz<ar23.length;zz++) { int aq=ar213[zz]; if(aq==0) { for(int pp=0;pp<ar23.length;pp++) { if(ar213[pp]==1) { int sum=ar21[pp]+ar21[zz]; if(sum<=10) c=99; } } } if(aq==1) { for(int pp=0;pp<ar23.length;pp++) { if(ar213[pp]==0) { int sum=ar21[pp]+ar21[zz]; if(sum<=10) c=99; } } } } if(c==99) return 1; else return 0; } }