CENS20G_Help_Martha

Could anyone help me understand why I get a WA on this?

https://www.codechef.com/viewsolution/37035087

What if the given coordinates are same as the coordinate on which he starts. Then it should print YES 0 whereas you code prints NO
Second thing is, suppose starting coordinate is 0,0 and the given coordinate is 1,0 and the string is LRUD. It should give YES 1, whereas your code prints NO

2 Likes

Updated the condition for same destination coordinate as starting coordinate.
It gives TLE now :frowning:

https://www.codechef.com/viewsolution/37035087

UPDATE: With scanf & printf I’m still getting WA.
https://www.codechef.com/viewsolution/37035194

2
RRRR
0 0
2
4 -0
0 0
LLLLUUUUUURRRRRRDDRR
-1 -1
2
3 3
2 2

consider these test cases your code is giving wrong output on these test cases.
i tried running your code on codechef online ide with these test cases it is also giving runtime error SIGCONT

Getting expected output. Idk what you’re trying to say! :confused:

Passing map everytime in the query was giving you TLE. I just put the whole solve function in your Query loop and got AC. Your AC Solution

1 Like

I wonder why passing a map would cause a TLE,it’s not like I am recomputing the map for every query.:confused:

You were passing the map and s by value, so both would be copied each time. Copying s Q times is obviously very expensive :slight_smile:

3 Likes

unfortunately i had not captured the screenshot but at that time when i tried to run your code i got the runtime error.
may be i had missed something while copying the code or something else went wrong.