362 - 18,000 Seconds Remaining

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

Moderator: Board moderators

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

362 - 18,000 Seconds Remaining

Post by Dominik Michniewski » Wed Jul 16, 2003 1:11 pm

Could anyone help me and post some tricky inputs for this problem ?
I'm stucked ... :( and don't know what am I doing wrong in my code ...

Any help would be appreciated :):)

Best regards
DM
If you really want to get Accepted, try to think about possible, and after that - about impossible ... and you'll get, what you want ....
Born from ashes - restarting counter of problems (800+ solved problems)

Andrey Mokhov
Experienced poster
Posts: 128
Joined: Fri Nov 15, 2002 7:45 am
Location: Kyrgyzstan

Post by Andrey Mokhov » Thu Jul 17, 2003 7:15 am

Hello, Dominik!

I've recently solved the problem and want to help you.
I tried my best to invent tricky tests and that's what I have:

Input:

Code: Select all

100
1
1
1
1
1
2
2
2
2
2
5
5
5
5
5
0
0
0
0
0
0
1
1
1
1
1
55



6
1
4
1


11
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
5
0
0
0
0
0
4

1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1


0
Output:

Code: Select all

Output for data set 1, 100 bytes:
   Time remaining: 95 seconds
   Time remaining: 43 seconds
   Time remaining: 12 seconds
   Time remaining: stalled
   Time remaining: 70 seconds
Total time: 27 seconds

Output for data set 2, 6 bytes:
Total time: 3 seconds

Output for data set 3, 11 bytes:
   Time remaining: stalled
   Time remaining: stalled
   Time remaining: stalled
   Time remaining: 50 seconds
   Time remaining: 45 seconds
   Time remaining: 4 seconds
Total time: 34 seconds

Output for data set 4, 1 bytes:
   Time remaining: stalled
   Time remaining: stalled
   Time remaining: 0 seconds
Total time: 15 seconds

Try it and get AC.
Best regards,
Andrey.

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

Post by Dominik Michniewski » Thu Jul 17, 2003 8:21 am

Thanks for this input - but unfortunatly my program produces right answers to this tests .... I must make a mistake, which is not visible in this tests ...

Best regards
DM
If you really want to get Accepted, try to think about possible, and after that - about impossible ... and you'll get, what you want ....
Born from ashes - restarting counter of problems (800+ solved problems)

Farid Ahmadov
Experienced poster
Posts: 131
Joined: Thu Apr 17, 2003 8:39 am
Location: Baku, Azerbaijan

Post by Farid Ahmadov » Sat Jul 19, 2003 12:56 pm

I get WA too.
For all test cases my program gives answers that Andrey wrote.
What else can there be.
Maybe you will say Andrey according to your program.
Thanks!
_____________
NO sigNature

Andrey Mokhov
Experienced poster
Posts: 128
Joined: Fri Nov 15, 2002 7:45 am
Location: Kyrgyzstan

Post by Andrey Mokhov » Sun Jul 20, 2003 12:54 pm

Hello, Farid!

If your program passes my test data it should be generally correct. The only thing I can guess is that you don't use only integers in your program when you calculate the time remaining. Be careful using floating-point numbers - they usually are the cause of lots of rounding errors... :-?

But if you use only integers - I have no idea where yout code fails. :cry:

I don't know whether I helped you or not - but I tried.

Bye.
Andrey.

Farid Ahmadov
Experienced poster
Posts: 131
Joined: Thu Apr 17, 2003 8:39 am
Location: Baku, Azerbaijan

Post by Farid Ahmadov » Sun Jul 20, 2003 5:01 pm

Thanks Andey. You are right. I use real type number. I'll change it and hope to get AC.
Bye.
_____________
NO sigNature

BaronSyntax
New poster
Posts: 3
Joined: Fri Jun 06, 2003 11:54 pm
Contact:

362 WA

Post by BaronSyntax » Sat Oct 25, 2003 10:41 pm

does anyone know if it's ok to assume that there won't be negative values for this problem. If so how should it be handled.
That's the only thing I can think of that my program won't take care of.
If that's not it then I don't know why I'm getting WA.
any help would be appreciated.

yz
New poster
Posts: 1
Joined: Sat Nov 01, 2003 5:41 pm

Post by yz » Sat Nov 01, 2003 5:57 pm

I used something like:
[cpp]ceil(remainBytes / ((float)transferedBytes / 5))[/cpp]
Hope it helps

Moinul(AUST)
New poster
Posts: 11
Joined: Tue Dec 10, 2002 11:40 am
Location: Dhaka, Bangaldesh
Contact:

Thanks to yz

Post by Moinul(AUST) » Mon Jan 12, 2004 12:34 pm

Many thanks to yz. Got AC for this problem

i had a problem in the 'remaining time' calculation which I corrected using the way yz specified
ceil(remainBytes / ((float)transferedBytes / 5))

-Moinul(AUST)
:D

sjn
Learning poster
Posts: 73
Joined: Mon Apr 08, 2002 8:22 am
Contact:

Post by sjn » Sun Jan 25, 2004 9:20 pm

i passed the input above
and i also used
[c]ceil(remainBytes / ((float)transferedBytes / 5))[/c]
Still got WA :(
Can anyone help me??? :cry:

sjn
Learning poster
Posts: 73
Joined: Mon Apr 08, 2002 8:22 am
Contact:

i hate this problem!

Post by sjn » Wed Jan 28, 2004 5:44 pm

At last i got AC

But i am still confused about this problem

i passed it by
[c]remainSecond = remainBytes/(transferedBytes/5.0);
printf("%d seconds\n", ceil(remainSecond)); [/c]

and always got WA by
[c]rate = transferedBytes/5.0;
printf("%d seconds\n", ceil(remainBytes/rate));[/c]
rate is double type

who can tell me why :(
Last edited by sjn on Mon Feb 02, 2004 5:26 pm, edited 1 time in total.

CDiMa
Experienced poster
Posts: 214
Joined: Fri Oct 17, 2003 5:49 pm
Location: Genova

Re: i hate this problem!

Post by CDiMa » Wed Jan 28, 2004 6:04 pm

sjn wrote: [c]remainSecond = remainBytes/(transferedBytes/5.0);
printf("%d seconds\n", ceil(remainSecond)); [/c]

and always got WA by
[c]rate = transferedBytes/5.0;
printf("%d seconds\n", ceill(remainBytes/rate));[/c]
rate is double type

who can tell me why :(
What types are remainBytes and transferedBytes ?

Ciao!!!

Claudio

sjn
Learning poster
Posts: 73
Joined: Mon Apr 08, 2002 8:22 am
Contact:

Post by sjn » Sat Jan 31, 2004 9:14 am

double

CDiMa
Experienced poster
Posts: 214
Joined: Fri Oct 17, 2003 5:49 pm
Location: Genova

Re: i hate this problem!

Post by CDiMa » Mon Feb 02, 2004 12:37 pm

sjn wrote: [c]printf("%d seconds\n", ceil(remainSecond)); [/c]
[c]printf("%d seconds\n", ceill(remainBytes/rate));[/c]
I noticed it only now... ceil against ceill !!!

Ciao!!!

Claudio

sjn
Learning poster
Posts: 73
Joined: Mon Apr 08, 2002 8:22 am
Contact:

Post by sjn » Mon Feb 02, 2004 5:34 pm

Sorry, what i mean is "ceil" :(
i made the mistake when i posted the topic

[c]double rate = transferedBytes/5.0;
printf("%d seconds\n", ceil(remainBytes/rate)); [/c]

i got WA by the code above.
i don't know why and u can try this yourself :-?

but many thanks to CDiMa for ur reply :wink:

Post Reply

Return to “Volume 3 (300-399)”