ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 2093. All Roads Lead to Snowdrift

WA 5
Posted by bsu.mmf.team 16 Jul 2016 02:13
Try this test:
100000 99999 0
1 2 1000000
2 3 1000000
...
99999 100000 1000000

Answer: 10049708502000000

Good Luck!
Re: WA 5
Posted by Felix_Mate 26 Jul 2017 14:08
Thanks!

HINT for solvers: In the test above, you can get an overflow. Change min(⌈(1 + T/100)* ti⌉, 100500*ti) to
long long my_ceil(long long tnow, long long f1, long long t)
{
    if(h1+tnow-f1>h2*h1) return h2*t;
    //return min(ceil(t+(tnow-f1)*t/100.0), h2*t);
    if(((tnow-f1)*t) % h1==0) return t+((tnow-f1)*t)/h1;
    else return t+((tnow-f1)*t)/h1 + h3;
}
//h1=100; h2=100500; h3=1;
where tnow=time now, f1=last cleaning time for this rib, s2=start time of next cleaning


Edited by author 26.07.2017 14:10