#include "overtaking.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
int n;
vector<ll> t, w;
int m;
vector<ll> s;
void init(int L, int N, std::vector<long long> T, std::vector<int> W, int X, int M, std::vector<int> S) {
n = N;
for (auto it : T) t.pb(it);
t.pb(0);
for (auto it : W) w.pb(it);
w.pb(X);
m = M;
for (auto it : S) s.pb(it);
assert(s[0]==0);
assert(s[m-1]==L);
}
ll arrival_time(ll Y) {
t[n] = Y;
ll x = t[0];
ll y = t[1];
for (int i=1; i<m; i++) {
ll new_x = x + (s[i] - s[i-1]) * w[0];
ll new_y = y + (s[i] - s[i-1]) * w[1];
if (new_x < new_y && y < x) new_x = new_y;
else if (new_y < new_x && x < y) new_y = new_x;
x = new_x;
y = new_y;
}
return y;
}
# | 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... |