# Hacker Earth Amazon All India Hiring Contest

Hey @vidyut_1 @vipin1407 @samarthtandon
I was able to solve first question completely and I got only 30 points (TLE for rest of cases ) in 2nd question even though I had solved using same approach as you all did using treeset.
Can you just tell where did I go wrong ?

``````static int[] GreaterEqual(int[] A, int[] X, int[] u, int[] L, int[] v){

int[] ans = new int[X.length];
ArrayList<ArrayList<Integer>> g= new ArrayList<>();

ArrayList<TreeSet<Integer>> lvl = new ArrayList<>();
for(int i=0;i<u.length+2;++i){
}
for(int i=0;i<u.length;++i){
}

int md=0;
boolean vis[]= new boolean[u.length+2];
int[] wl= new int[u.length+2];
while(!q.isEmpty()){
int n=q.poll();
if(vis[n]) continue;
vis[n]=true;

if(!vis[x]){
wl[x]=wl[n]+1;
md=Math.max(md,wl[x]);
}

}

}
for(int i=0;i<ans.length;++i){
int ll=L[i]%(md+1) ;
Integer aa=lvl.get(ll).ceiling(X[i]);
if(aa==null){
ans[i]=-1;
}
else{
ans[i]=aa;
}

}

return ans;

}``````

Hi @cis_pie,
Your code is fine. This issue is in the âSystem.out.printlnâ statement. I also got TLE because of that.
I had to change to âBufferedWriterâ to resolve the TLE.
Thanks

@ganesh92
Problem statments are not visible now.

@vidyut_1
So much disappointingâŚ
I was too much frustrated at that point because i submitted this solution in last minute.
is there anything that I can do now ? like mail them and tell them that its just fast input output ?
Can I submit same code again and then share link with them ?
Can we submit again ? I think problems are not in practice section.

I think you should mention them about this fast input output issue. The âSystem.out.printlnâ code was given by them. We were supposed to complete the methods.

Problems are in the practice section

yes submitted and got AC by just changing output method.
https://www.hackerearth.com/submission/26466892/

1 Like

Thanks, @vidyut_1
Changed output from Sytem.out.println to printwriter.println and it magically passed but I could not do that during contest.

Orginal : https://www.hackerearth.com/submission/26155174/
Changed only output method : https://www.hackerearth.com/submission/26466892/

hurray:partying_face:

you are welcome

1 Like

Hi @vipin1407 when is your interview scheduled?

NopeâŚI donât know whyâŚI score full 200

1 Like

here is the link for DRY RUN

1 Like

anyone from 2020 batch get the mail ??

1 Like

I think people from 2-3rd year did not get any mail. Which year are you in???

3rd year 2020 batch âŚ

I completed both the questions , still havenât received any email. Anyone has any idea what could be the possible reason?..or should I wait till 10th june.

IAM from 4th year.i solved both the questions but didnât get the mail.

Even I solved both the questions, that too within 30 minsâŚstill didnât received the mail! Disappointed!!

Means there are chances to get mail until 10 june