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 all(x) x.begin(),x.end()
const int N = 2e5 + 1;
#define ll long long
vector<pair<ll, int>>t; vector<int> d;
int n, m;
void init(int L, int NN, vector<ll> T, vector<int>W, int X, int MM, vector<int>s) {
n = NN, m = MM;
t.clear();
t.resize(n + 1);
d.clear();
d.resize(m);
for (int i = 0; i < n; i++) {
t[i].first = T[i];
}
for (int i = 0; i < n; i++) {
t[i].second = W[i];
}
for (int i = 0; i < m; i++) {
d[i] = s[i];
}
t[n].second = X;
return;
}
ll arrival_time(ll x) {
t[n].first = x;
pair<ll, int>p = t[n];
int prv = 0;
for (int i = 0; i < m; i++) {
sort(all(t));
ll mx = 0;
for (int j = 0; j <= n; j++) {
ll x = (d[i] - prv) * t[j].second + t[j].first;
mx = max(mx, x);
if (p == t[j]) {
p = { mx,t[j].second };
}
t[j] = { mx,t[j].second };
}
prv = d[i];
}
return p.first;
}
# | 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... |