Page 3 of 4

Posted: Mon Jul 30, 2007 12:14 pm
by chetan
what is the reason for RE ???
:cry: :cry:
please help me

Posted: Mon Jul 30, 2007 12:43 pm
by chetan
still cant figure out :cry: :cry: :cry: :cry: :cry:

Posted: Mon Jul 30, 2007 10:18 pm
by A1
You r doing DFS, which is causing stack overflow and so it is RE!
Try to convert it to BFS.

Posted: Tue Jul 31, 2007 7:18 am
by chetan
what r the limits for this problem ????
i think many ppl have solved this using dfs

Posted: Tue Jul 31, 2007 7:58 am
by helloneo
Somtimes your recursive function doesn't return.. That's why you got RE..

Posted: Tue Jul 31, 2007 5:12 pm
by chetan
when exactly doesnt it return ???
could you please give me a test case for that
thanks
:)

Posted: Tue Jul 31, 2007 6:06 pm
by helloneo
I'm sorry.. maybe I misunderstood your code.. :cry:

Btw, your code doesn't print the correct answer for the sample input ..

Posted: Tue Jul 31, 2007 6:17 pm
by chetan
have posted working code now.
pls help me out.

Posted: Tue Jul 31, 2007 6:33 pm
by helloneo
Try this input..

Code: Select all

A B C D E F G
H I J K L M N
O P Q R S T U
V W X Y Z A B
C D E F G H I
J K L M N O P
Q R S T U V W
X Y Z A B C D
E F G H I J K
L A A A A A A
%
A B
My output is..

Code: Select all

 1  2  3  4  5  6  7
 8  9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31 32 33 34 35
36 37 38 39 40 41 42
43 44 45 46 47 48 49
50 51 52 53 54 55 56
57 58 59 60 61 62 63
64 65 65 65 65 65 65
%
1 2
%
:-)

Posted: Wed Aug 01, 2007 8:24 am
by chetan
now i am getting WA with my code .
plz help

(have posted the WA code above) :cry: :cry: :cry: :cry:

Posted: Sat Aug 04, 2007 1:03 pm
by chetan
plz help me ........... y WA ????
:cry: :cry: :cry:

Posted: Sun Aug 05, 2007 12:49 am
by A1
Chetan:
Add the Bold three line in your code. It will fix your input taking problem.
And both of you (kolpobilashi and chetan) can try the I/O.
while(1)
{
if(ch==EOF)break;
i=j=0;
memset(seen,0x0,sizeof(seen));
memset(arr,0x0,sizeof(arr));

while((ch = getchar()) !='%')
{
if(ch==EOF)break;
if(ch ==' ') continue;
else if(ch == '\n')
{
i++;
j=0;
continue;
}
else arr[j++]=ch;
c=j;

}

r=i;
if(ch!=EOF)
getchar();

Inputs:

Code: Select all

a A b B c d E t
a a a a a c c t
e f g h c a a t
e e a g g c t a
e a e e g t c a
a e e g t t c a
e a a e g t a c
e e e a t a g c
e a t a a t g c
%
a a a a a a a a
a a a a a a a a
a a a a a a a a
a a a a a a a a
a a a a a a a a
a a a a a a a a
%
a b c d e f g h
h g f e d c a b
a b c d e f g h
h g f e d c a b
a b c d e f g h
h g f e d c a b
a b c d e f g h
h g f e d c a b
a b c d e f g h
h g f e d c a b
a b c d e f g h
h g f e d c a b
a b c d e f g h
h g f e d c a b
a b c d e f g h
h g f e d c a b
a b c d e f g h
h g f e d c a b
a b c d e f g h
h g f e d c a b
a b c d e f g h
h g f e d c a b
a b c d e f g h
h g f e d c a b
a b c d e f g h
h g f e d c a b
a b c d e f g h
h g f e d c a b
a b c d e f g h
h g f e d c a b
a b c d e f g h
h g f e d c a b
a b c d e f g h
h g f e d c a b
a b c d e f g h
h g f e d c a b
a b c d e f g h
h g f e d c a b
a b c d e f g h
h g f e d c a b
a b c d e f g h
h g f e d c a b
a b c d e f g h
h g f e d c a b
%
a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m A A
A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A B
B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B C
%
A B D E C C D
F F W D D D D
P W E W W W W
%
A
Outputs Should be:

Code: Select all

1  2  3  4  5 6  7 8
1  1  1  1  1 5  5 8
9 10 11 12  5 1  1 8
9  9  1 11 11 5  8 1
9  1  9  9 11 8  5 1
1  9  9 11  8 8  5 1
9  1  1  9 11 8  1 5
9  9  9  1  8 1 13 5
9 14 15  1  1 8 13 5
%
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
%
  1   2   3 4 5   6   7   8
  9  10  11 5 4  12  13  14
 15  16  17 4 5  18  19  20
 21  22  23 5 4  24  25  26
 27  28  29 4 5  30  31  32
 33  34  35 5 4  36  37  38
 39  40  41 4 5  42  43  44
 45  46  47 5 4  48  49  50
 51  52  53 4 5  54  55  56
 57  58  59 5 4  60  61  62
 63  64  65 4 5  66  67  68
 69  70  71 5 4  72  73  74
 75  76  77 4 5  78  79  80
 81  82  83 5 4  84  85  86
 87  88  89 4 5  90  91  92
 93  94  95 5 4  96  97  98
 99 100 101 4 5 102 103 104
105 106 107 5 4 108 109 110
111 112 113 4 5 114 115 116
117 118 119 5 4 120 121 122
123 124 125 4 5 126 127 128
129 130 131 5 4 132 133 134
135 136 137 4 5 138 139 140
141 142 143 5 4 144 145 146
147 148 149 4 5 150 151 152
153 154 155 5 4 156 157 158
159 160 161 4 5 162 163 164
165 166 167 5 4 168 169 170
171 172 173 4 5 174 175 176
177 178 179 5 4 180 181 182
183 184 185 4 5 186 187 188
189 190 191 5 4 192 193 194
195 196 197 4 5 198 199 200
201 202 203 5 4 204 205 206
207 208 209 4 5 210 211 212
213 214 215 5 4 216 217 218
219 220 221 4 5 222 223 224
225 226 227 5 4 228 229 230
231 232 233 4 5 234 235 236
237 238 239 5 4 240 241 242
243 244 245 4 5 246 247 248
249 250 251 5 4 252 253 254
255 256 257 4 5 258 259 260
261 262 263 5 4 264 265 266
%
 1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 66
66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 67
67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 68
%
1 2 3 4 5 5 3
6 6 7 3 3 3 3
8 7 9 7 7 7 7
%
1
%

776 PE to WR

Posted: Fri Oct 26, 2007 5:14 am
by sapnil
Hi
At first i get PE,but now i get WR.
I test all the test cases of board.
Plz Help me.............

Code: Select all


// Delete after ACC

Thanks
Keep posting
Sapnil

Re: 776 - Monkeys in a Regular Forest

Posted: Tue Sep 30, 2008 8:47 am
by Chirag Chheda
I have got loads of PE on this problem

can any1 plz tell me the correct output format of this input

Input:

Code: Select all

a
s
d
f
g
h
j
k
l
q
w
Output1

Code: Select all

1
2
3
4
5
6
7
8
9
10
11
%
Output2:

Code: Select all

 1<-there is a space before every 1 digit number
 2
 3
 4
 5
 6
 7
 8
 9
10
11
Any help is appreciated.
Thnx in advance

Re: 776 - Monkeys in a Regular Forest

Posted: Tue Mar 10, 2009 7:34 am
by Chirag Chheda
Can someone please reply. :oops: