Page 1 of 6

362 - 18,000 Seconds Remaining

Posted: Wed Jul 16, 2003 1:11 pm
by Dominik Michniewski
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

Posted: Thu Jul 17, 2003 7:15 am
by Andrey Mokhov
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.

Posted: Thu Jul 17, 2003 8:21 am
by Dominik Michniewski
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

Posted: Sat Jul 19, 2003 12:56 pm
by Farid Ahmadov
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!

Posted: Sun Jul 20, 2003 12:54 pm
by Andrey Mokhov
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.

Posted: Sun Jul 20, 2003 5:01 pm
by Farid Ahmadov
Thanks Andey. You are right. I use real type number. I'll change it and hope to get AC.
Bye.

362 WA

Posted: Sat Oct 25, 2003 10:41 pm
by BaronSyntax
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.

Posted: Sat Nov 01, 2003 5:57 pm
by yz
I used something like:
[cpp]ceil(remainBytes / ((float)transferedBytes / 5))[/cpp]
Hope it helps

Thanks to yz

Posted: Mon Jan 12, 2004 12:34 pm
by Moinul(AUST)
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

Posted: Sun Jan 25, 2004 9:20 pm
by sjn
i passed the input above
and i also used
[c]ceil(remainBytes / ((float)transferedBytes / 5))[/c]
Still got WA :(
Can anyone help me??? :cry:

i hate this problem!

Posted: Wed Jan 28, 2004 5:44 pm
by sjn
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 :(

Re: i hate this problem!

Posted: Wed Jan 28, 2004 6:04 pm
by CDiMa
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

Posted: Sat Jan 31, 2004 9:14 am
by sjn
double

Re: i hate this problem!

Posted: Mon Feb 02, 2004 12:37 pm
by CDiMa
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

Posted: Mon Feb 02, 2004 5:34 pm
by sjn
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: