I read other posts about this and tried almost all test cases given on SPOJ Toolkit and it seems to work fine, but when I submit on SPOJ, it says wrong answer on judge 9.
Please Check.
Solution is here
I read other posts about this and tried almost all test cases given on SPOJ Toolkit and it seems to work fine, but when I submit on SPOJ, it says wrong answer on judge 9.
Please Check.
Solution is here
3
-1 -1 -1
1
1 2
check this test case
Your ans is 0, should be -1
otherwise your code seems ok
@neilit1992 thanks for the response, I fixed the code, it now works on this case but still shows WA on spoj.
Please Check line 53, I updated there.
Here’s The code
Thanks.
I checked it with @neilit1992 s code, tried inputs from spojtoolkit and even printed all the nodes of segment trees of both the programs (mine and @neilit1992 ) and they were exactly same.
Still no Luck
Thats my
[1]
If someone can provide some more boundary cases (except those on spoj toolkit) that would be really helpful.
Thanks
[1]: http://ideone.com/x52qvD
Check Line 58, shouldn’t you return best sum as minimum value?
Please Check, I guess the following code should be there:
return (node)
{min,
min,
min,
min
};
@shraeyas the problem is in this line
pr.best = maxfun(maxfun(left.rsum+right.total, left.total + right.lsum),maxfun(left.best, right.best));
It should be corrected to
pr.best = maxfun(left.rsum + right.lsum, maxfun(left.best, right.best));
However this will still give you TLE since you are using a map. Access is faster on an array than a map, so use a large enough array instead and you should get AC
First of all, apologies @shraeyas for random suspension you went through since last 4 hours.
This being a long story, please bear with me.
@shraeyas was suspended earlier on 3rd March due to spamming activity on discussion forum for 15 days i.e. till 18th March. But we recently found out bug in auto removal of suspension and got fixed today morning. After this all users who were temporary suspended, got their accounts back on discuss (including @shraeyas).
But, unfortunately that fix didn’t propagated to the new servers which were specially started before Alkhwarizm contest and had older code. Hence, his account was again visible as suspended from ~8:30PM. Thanks @shubham_genius, @neilit1992 and @meooow to bring it into notice, and new fix has been propagated properly.
(posing as answer, due to characters limit in comment)
nc0ibW - Online C++0x Compiler & Debugging Tool - Ideone.com this is my working code, please try to debug
Thank You
it’ll give error, I tried that, there is some bug in the code and its difficult to debug!
Ohhkay, BTW why has the author been suspended?
I’ve no idea, why people get suspended
@meooow Don’t know how to express my thanks to you.
Was really frustated with this one.
Thank you so much @meooow and @neilit1992
Oh, didn’t came across your email, but got similar info from another user. Anyway, the bug is finally removed from auto removal of suspension. Welcome back to discuss.
And refrain spamming in future…
Sure… will stick to that
Thanks
So that’s the case! I was quite confused when I saw it. It also did not show which admin suspended it and why. Well, this explains things!