This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "overtaking.h"
#include <bits/stdc++.h>
using namespace std;
#define int long long
int l,n,x,m;
vector<int> t,w,s;
void init(signed L, signed N, std::vector<long long> T, std::vector<signed> W, signed X, signed M, std::vector<signed> S)
{
l=L;
n=N;
x=X;
m=M;
t.assign(T.begin(),T.end());
s.assign(S.begin(),S.end());
w.assign(W.begin(),W.end());
return;
}
long long arrival_time(long long Y)
{
if(x>=w[0]||t[0]>=Y) return ((x*l) + Y); // cest plus lent que lautre bus ou commence avant
int eqPos=m; // ou il se rencontre et dabord a m vu que cest apres lhotel
for (int i = 1; i < m; i++) // check toute les station
{
//cerr << (x*s[i])+Y << " " << t[0]+(w[0]*s[i]) << "\n";
if((x*s[i])+Y<=t[0]+(w[0]*s[i])) {eqPos=i; break;} // si
}
//cerr << eqPos << "\n";
if(eqPos>=m) return ((x*l) + Y);
if(eqPos==m-1) return ((w[0]*l)+t[0]);
return ((w[0]*s[eqPos])+t[0])+((l-s[eqPos])*x);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |