10901 - Ferry Loading III

All about problems in Volume 109. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Mukit Chowdhury
Learning poster
Posts: 99
Joined: Fri Aug 17, 2012 9:23 pm
Location: Dhaka
Contact:

Re: 10901 - Ferry Loading III

Post by Mukit Chowdhury »

Is there anyone to check my code ??? I am really disappointed with this one..... :(
Got WA several times.... But haven't found any error....... :(

Code: Select all

Accepted ...
for input...

Code: Select all

9
1 5 2
0 right
0 left
2 5 2
0 left
0 left
2 5 2
0 right
0 right
3 5 7
0 left
1 left
2 left
3 left
5 left
5 right
11 right
1 5 2
0 right
1 left
2 5 2
0 right
6 right
2 5 2
0 right
5 right
2 10 10
0 left
10 left
20 left
30 left
40 left
50 left
60 right
70 left
80 left
90 left
1 10 10
0 left
10 left
20 left
30 left
40 left
50 left
60 right
70 left
80 left
90 left
my output is.....

Code: Select all

10
5

5
5

10
10

5
15
15
15
25
10
20

10
15

10
20

10
10

10
30
30
50
50
70
80
90
90
110

10
30
50
70
90
110
80
130
150
170
which is like as UVA toolkit.... :(
Can anyone give me any case for which my code fails ????
Last edited by Mukit Chowdhury on Thu Dec 20, 2012 8:08 am, edited 2 times in total.
Mukit Chowdhury
Learning poster
Posts: 99
Joined: Fri Aug 17, 2012 9:23 pm
Location: Dhaka
Contact:

Re: 10901 - Ferry Loading III

Post by Mukit Chowdhury »

At last I've got a input for which my code's output and toolkit's output doesn't match....
for input..

Code: Select all

1
2 1 2
3 right
4 left
toolkit shows...

Code: Select all

5
5
where my code shows...

Code: Select all

5
6
when a cargo come in right bank at 3 minutes,then the ferry goes to right bank from left to unload that in the left bank...so it takes 3+1+1=5.when the ferry is in left bank now,this time another cargo came here at 4 minutes...so now the ferry take this cargo to right bank ... so it takes 5+1=6 minutes... Where is my fault ??? @brianfry713
brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 10901 - Ferry Loading III

Post by brianfry713 »

for input:

Code: Select all

1
2 1 2
3 right
4 left
uvatoolkit matches my AC code

Code: Select all

5
6
Post your latest code if you still want help.
Check input and AC output for thousands of problems on uDebug!
brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 10901 - Ferry Loading III

Post by brianfry713 »

Try input:

Code: Select all

1
1 10 3
0 left
10 right
30 left
AC output:

Code: Select all

10
20
40
Check input and AC output for thousands of problems on uDebug!
Mukit Chowdhury
Learning poster
Posts: 99
Joined: Fri Aug 17, 2012 9:23 pm
Location: Dhaka
Contact:

Re: 10901 - Ferry Loading III

Post by Mukit Chowdhury »

This is my edited code... And got WA again... :(
This time I'm trying to tell my algo writing comments ....
for both bank,I have done same things... so I wrote in right bank part...that means when 'fg' is zero...

Code: Select all

Accepted... :)
Last edited by Mukit Chowdhury on Thu Dec 20, 2012 8:07 am, edited 1 time in total.
brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 10901 - Ferry Loading III

Post by brianfry713 »

Input:

Code: Select all

1
1113 1072 77
8631 left
12526 left
15884 left
19388 left
24635 left
30627 right
30627 left
31757 left
35635 right
36133 left
40444 left
43028 left
48810 right
52970 left
58960 left
68435 left
77823 right
86506 right
92642 right
102502 right
110157 right
112155 right
121380 left
129976 left
134712 left
140337 right
142189 left
144235 left
148270 right
157807 right
160444 left
166168 right
171785 left
176555 right
183147 right
187360 right
189997 left
192976 right
195552 right
202674 right
205500 right
212938 right
216050 left
219441 left
227288 left
235539 right
240714 left
244301 left
252681 left
257382 left
263605 left
264979 right
272262 right
276221 left
285386 left
293636 right
298542 right
306290 left
312539 right
318783 right
325007 right
330665 left
340213 left
345639 right
346477 left
352612 right
353809 left
362968 left
366989 right
376408 left
380605 left
386860 left
391294 left
400573 left
407871 left
413728 left
414823 left
AC output:

Code: Select all

9703
14670
18028
21532
26779
33843
32771
34915
36707
37779
42588
45172
49882
54042
61104
70579
78895
88650
94786
104646
112301
114445
122452
132120
136856
141409
143261
146379
149342
159951
161516
167240
172857
177627
185291
189504
191069
194048
197696
204818
207644
215082
217122
221585
229432
236611
241786
246445
254825
259526
265749
266821
274406
277293
287530
294708
300686
307362
313611
320927
327151
331737
342357
346711
347783
353684
354881
365112
368061
377480
382749
389004
393438
402717
410015
415872
418016
Check input and AC output for thousands of problems on uDebug!
Mukit Chowdhury
Learning poster
Posts: 99
Joined: Fri Aug 17, 2012 9:23 pm
Location: Dhaka
Contact:

Re: 10901 - Ferry Loading III

Post by Mukit Chowdhury »

@brianfry713... for input...

Code: Select all

24635 left
the ferry is in right bank now and time passed is 26779. Now it'll wait as there is no car at any bank. Right ?
On 30627, two car comes in two bank of the river... As the ferry is on right bank now,so it must take the car of right bank. So the arrival time at left side of this car will be 30627+1072=31699.Now from left bank,the ferry will take the car which came on 30627. so it will go to the right bank on 31699+1072=32771...
toolkit doesn't match with neither me nor your output... Where is my wrong ???
for this part of your input...

Code: Select all

30627 right
30627 left
31757 left
your output is

Code: Select all

33843
32771
34915
my output is

Code: Select all

31699
32771
34915
and toolkit shows...

Code: Select all

32139
33211
33211
And every others outputs match with you & toolkit too.
Mukit Chowdhury
Learning poster
Posts: 99
Joined: Fri Aug 17, 2012 9:23 pm
Location: Dhaka
Contact:

Re: 10901 - Ferry Loading III

Post by Mukit Chowdhury »

Actually it's very frustrating when I've not found any error but got WA continuously ........ :(
Last edited by Mukit Chowdhury on Sun Oct 20, 2013 3:07 am, edited 1 time in total.
brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 10901 - Ferry Loading III

Post by brianfry713 »

Yes I agree with you, your code is correct for that input. I modified my code to handle that case and it now matches your output and still gets AC. Here's another input:

Code: Select all

1
214 12 94
71 right
105 left
129 right
173 left
214 left
285 right
327 left
388 right
448 left
547 right
617 left
631 left
707 left
733 left
734 right
799 right
816 right
869 left
936 right
1019 right
1026 left
1068 right
1138 right
1147 left
1157 right
1234 right
1327 right
1359 left
1435 left
1467 left
1483 right
1565 right
1659 left
1699 left
1797 right
1798 left
1841 left
1861 left
1906 left
1913 left
1982 right
2016 left
2057 left
2118 right
2175 right
2235 right
2256 left
2329 left
2371 right
2413 left
2482 left
2491 left
2543 right
2633 left
2657 right
2742 left
2823 left
2910 left
2926 left
2931 left
2937 right
2950 right
2989 left
2998 left
3029 left
3081 left
3141 right
3151 right
3208 right
3282 right
3345 right
3351 left
3359 right
3390 right
3397 left
3462 right
3462 right
3469 right
3565 left
3617 left
3650 left
3743 right
3840 left
3910 right
3979 right
4046 right
4080 right
4121 right
4220 right
4220 left
4227 left
4313 right
4388 right
4467 right
My new code's AC output:

Code: Select all

95
117
141
185
238
297
339
400
460
559
629
655
731
757
769
823
847
881
948
1043
1055
1080
1162
1174
1186
1258
1351
1371
1459
1491
1503
1589
1671
1723
1809
1821
1865
1889
1930
1930
1994
2028
2081
2130
2199
2259
2271
2353
2383
2425
2506
2506
2555
2645
2669
2754
2847
2934
2958
2958
2970
2970
3001
3025
3053
3105
3153
3177
3232
3306
3369
3381
3393
3417
3429
3474
3474
3498
3577
3641
3674
3755
3852
3922
4003
4070
4104
4145
4244
4232
4256
4325
4412
4491
Check input and AC output for thousands of problems on uDebug!
Mukit Chowdhury
Learning poster
Posts: 99
Joined: Fri Aug 17, 2012 9:23 pm
Location: Dhaka
Contact:

Re: 10901 - Ferry Loading III

Post by Mukit Chowdhury »

Thanks a lot... @brianfry713.... It's accepted now..... :D
Your last input was the key... :)
I never thought this case... :)
And again thanks as I know how complex the code is !!! But you have tried to find the bug... Thanks a lot... :)
tapan_chugh
New poster
Posts: 5
Joined: Wed Dec 26, 2012 6:46 am

Re: 10901 - Ferry Loading III

Post by tapan_chugh »

Hello,
I am getting WA for this problem even though i have tried the tricky cases. Below is my code

Code: Select all

AC...:)
Please try to help
Last edited by tapan_chugh on Wed Dec 26, 2012 2:58 pm, edited 1 time in total.
Mukit Chowdhury
Learning poster
Posts: 99
Joined: Fri Aug 17, 2012 9:23 pm
Location: Dhaka
Contact:

Re: 10901 - Ferry Loading III

Post by Mukit Chowdhury »

tapan_chugh wrote:Hello,
I am getting WA for this problem even though i have tried the tricky cases. Below is my code
Please try to help
Try this case....

Code: Select all

1
4 3 3
76 left
83 left
97 left
output must be...

Code: Select all

79
89
103
where your code gives

Code: Select all

79
86
100
hope it will help...
tapan_chugh
New poster
Posts: 5
Joined: Wed Dec 26, 2012 6:46 am

Re: 10901 - Ferry Loading III

Post by tapan_chugh »

Thanks, Mukit Chowdhury
Mukit Chowdhury
Learning poster
Posts: 99
Joined: Fri Aug 17, 2012 9:23 pm
Location: Dhaka
Contact:

Re: 10901 - Ferry Loading III

Post by Mukit Chowdhury »

@tapan_chugh, It'll be better if you delete your code... :)
mahade hasan
Learning poster
Posts: 87
Joined: Thu Dec 15, 2011 3:08 pm
Location: University of Rajshahi,Bangladesh

Re: 10901 - Ferry Loading III

Post by mahade hasan »

thanks .....
AC now
Last edited by mahade hasan on Tue Mar 05, 2013 7:33 am, edited 1 time in total.
we r surrounded by happiness
need eyes to feel it!
Post Reply

Return to “Volume 109 (10900-10999)”