274 - Cat and Mouse
Moderator: Board moderators
274
is there any trick on this problem? i've got WA on this.
first, i search all the room visitable by the cat and put the flag on.
next, i just search all the room visitable by the mouse. If the room's flag is on then mouse can meet the cat. if later, the mouse starting room is visited by the mouse again, then the cat can walk between rooms without having to meet the cat.
my solution works with the sample test case and official test case (ACM94). Do i miss something here?
first, i search all the room visitable by the cat and put the flag on.
next, i just search all the room visitable by the mouse. If the room's flag is on then mouse can meet the cat. if later, the mouse starting room is visited by the mouse again, then the cat can walk between rooms without having to meet the cat.
my solution works with the sample test case and official test case (ACM94). Do i miss something here?
274 runtime error ?!
I keep getting runtime error for this problem. I do not think I am reading the input correctly. Can someone show me how to read the input for this problem?
-
- Experienced poster
- Posts: 187
- Joined: Wed Dec 11, 2002 2:03 pm
- Location: Mount Papandayan, Garut
274 cat & mouse TLE
i cant believe i got TLE for this problem. i've use DFS and also Transitive Closure, both of them got TLE. Do you have any suggestion or sample critical input ?
with love & light
titid
with love & light
titid
Kalo mau kaya, buat apa sekolah?
-
- Guru
- Posts: 1080
- Joined: Thu Dec 19, 2002 7:37 pm
-
- Experienced poster
- Posts: 187
- Joined: Wed Dec 11, 2002 2:03 pm
- Location: Mount Papandayan, Garut
well i use something like flood_fill too, but i think that's DFS. how can you got AC?
oke here is my code :
[c]
--- cut got AC----
[/c]
oke here is my code :
[c]
--- cut got AC----
[/c]
Last edited by titid_gede on Sat May 17, 2003 3:40 pm, edited 1 time in total.
Kalo mau kaya, buat apa sekolah?
-
- Guru
- Posts: 1080
- Joined: Thu Dec 19, 2002 7:37 pm
Don't expect any help from me when you give wrong information
I spent almost half an hour looking at your code trying to find the cause of the TLE that you said you had. Then I submitted your code to the judge and got WA in 0.045 sec!
I tried to help you, but was looking in the wrong direction because you gave me the wrong information.
Your code is correct in principle, but doesn't catch all tricky input. But I am not going to help you anymore.

I spent almost half an hour looking at your code trying to find the cause of the TLE that you said you had. Then I submitted your code to the judge and got WA in 0.045 sec!
I tried to help you, but was looking in the wrong direction because you gave me the wrong information.
Your code is correct in principle, but doesn't catch all tricky input. But I am not going to help you anymore.
-
- Experienced poster
- Posts: 187
- Joined: Wed Dec 11, 2002 2:03 pm
- Location: Mount Papandayan, Garut
-
- Experienced poster
- Posts: 187
- Joined: Wed Dec 11, 2002 2:03 pm
- Location: Mount Papandayan, Garut
274- Cat n Mouse - TLE
somebodyyy helppp
i had tried 5 types of coding for this problem
using linked list.
but in the end , i got the same result.
TIME LIMIT EXCEEDED.

i had tried 5 types of coding for this problem
using linked list.
but in the end , i got the same result.
TIME LIMIT EXCEEDED.

-
- Guru
- Posts: 834
- Joined: Wed May 29, 2002 4:11 pm
- Location: Wroclaw, Poland
- Contact:

thanx
i used 2 DLinked list, or he cat n the mouse
i tried the sample case from the web
n i got the correct answer.
but now when i submit it , WRONG ANSWER.
"Your program has not solved the problem. It ran during 6.598 seconds"
i wanna ask
1. the problem said that the first answer is 'y' if the cat can meet the mouse in some room. is it means there shoud be more than 1 room where they can meet each other (2 rooms or above) to get the first 'y'?
2. can the cat meet the mouse in the mouse first room or can the cat enter the mouse room?
i already test my source code in thousands of case n i think i got the right answers for all of them. but its still wrong answer in the end
i assume that in the cat's first room, there is a cat.
so if the case is:
2
10 1 2
-1 -1
2 1
1 2
100 50 50
-1 -1
the answer is
"y n" -->or "n n" how many meeting rooms required to get the first 'y'?????
and for the seccond case
"y n" -->or "n n" ?????????????
can somebody help me with some other sample case??
pleaaseeeee
i just wanna make sure that i am right
thanxxx.
-
- New poster
- Posts: 38
- Joined: Mon Dec 09, 2002 1:53 pm
- Location: Poznan, Poland
WA
hello,
i am constantly getting wa with this problem
so can somebody please help?
is the input realy in this format?
number_of_test_cases
blank_line
rooms cat_start mouse_start
list of cat edges
-1 -1
list of mouse edges
blank_line
the same for next case
i consider following tricky cases:
- cat and mouse have the same start room: Y N
- there are no cat or mouse edges
are there more tricks? thank you
i am constantly getting wa with this problem

is the input realy in this format?
number_of_test_cases
blank_line
rooms cat_start mouse_start
list of cat edges
-1 -1
list of mouse edges
blank_line
the same for next case
i consider following tricky cases:
- cat and mouse have the same start room: Y N
- there are no cat or mouse edges
are there more tricks? thank you