Untitled
unknown
plain_text
2 years ago
493 B
19
Indexable
int findHightime(ll curT,ll l,ll d,ll k){
curT=min(curT,l+(k-1)*d); //required time, last train
if(curT<l) return -1; //no train before time l
ll ind=(curT-l)/d;
return l+ind*d;
}
/***************function 2*************************************/
auto getNextTime=[&](lli curT,const lli l,const lli d,const lli k)->lli{
curT=min(curT,l+d*(k-1));
if(curT<l)
return -1;
const lli idx = (curT-l)/d;
return l+idx*d;
};
Editor is loading...
Leave a Comment