This is strange… If c++ passes why not c
this is the reason…
In short, recursive solution is the reason for the RE (stack overflow)
solution in C:
same solution in C++:
Yeah I read everything but then why is c++ solution passing ??
that’s an HackerEarth thing…so much c++ centric
I used priority queue and solved it
didn’t knew if this was DFS
Now I can have a look at all solution links
try this thing in programming language other than c++…
I have even set the recursion limit in it that’s why I am getting one more correct.Our algo is exactly same.
It is not a problem of recursion limit as recursion depth can be atmost n
It is a problem with hackerearth’s system/server
How did you solve it with priority queue.What’s your algorithm
My algorithm is push all of them(both arrays) according to time in a priority queue…
Handle case when time are equal properly (fix appropriate priority)
Then push element into stack when something starts at that time… and pop it when it ends… when you pop the element the next element in stack would be his parent.
I am in little hurry rn… ping me if u don’t understand this message.
I am on a vacation in Kashmir since last 5 days, hence couldn’t solve more than 3-problems.
Problems have lots of error and they don’t seem worth it to me. Many times my incorrect code gets AC and correct code gets WA. Like…
The second problem , even though I got 100 points in it. I know for a fact that there is a logical error in it. To minimize stuff, we chose the median, but depending on ‘k’ , many values other than median can give much better answers which was not considered in the problem.
Hackerearth continuously disappoints me like this. Maybe this is my last contest there.
I’ll better stick to Codechef and Codeforces.
Yes I agree with the fact that there problem description is getting worst contest by contest
but there problem sets are quite good and challenging…this is the only reason why I stick to HACKEREARTH
Please explain the logic of “Ineffective guard” problem.