← Back to topics
Topic

z-pharaoh

t
thocevar
Does anyone know the evil behind pharaoh's test case #3?
I've run out of ideas.
A
Amtrix
Well i used backtracking , and passed all tests.
g
gates
he isn't asking for the solution of problem..but for some tricky case..
anyway, I have problem with this task too..I'm getting WA on 4th case constantly
D
Daniel93
My code passes for now only the 4-th case :P
o
oduleodule
@thocevar

Cascade of floating stairs. Several ups and falls.
o
oduleodule
@Daniel. Always look above Your head.
b
boba5551
@gates: When you are stepping at the next level, are you checking is there free space one level above your current position?
A
Amtrix
Input:
99
50
50 1 0
....
Removed
...
49 14 -3
Output:
-4
If my solution is correct . . .
g
gates
@boba5551: yes, that was the problem..thank you very much
D
Daniel93
Hmm. I have tried some tricky cases but still don't passing the grading tests. Can someone give me a test case please?
o
oduleodule
@Amtrix: Yes, Your solution is OK.
t
thocevar
Is it possible to let me know whether my solution returns an answer which is too big or is my answer too small?
o
oduleodule
Email me on odule[at]sbb.rs and put Your solution in mail.
t
thocevar
Thanks for the input, it helped.

There's a small problem with test case 3. Pedja starts on coordinates ((n+1)/2, 1, 0), but the block ((n+1)/2, 1, -1) is stolen, so he has nothing to stand on at the beginning.
By my logic Pedja started falling down even before he could make his first step. Just take into account that Pedja can fly at the start before he makes his first move. :)
o
oduleodule
Thanks to You for this post. Somehow this happen, but I don't wont this. It was described that counting start after Pedja make his first move so I did not think that this can be problem. Anyway You right. (Your Pedja miss first floating stairs and stay trapped on lowest level I suppose)

I fixed this.
c
carlosjoa
@oduleodule
What's so tricky about case #4?
o
oduleodule
as Boba says

When you are stepping at the next level, are you checking is there free space one level above your current position?
c
carlosjoa
Thanks... My code checked for this condition but I wrote cur.h instead of cur.h+1.