#include "bits/stdc++.h"
#include "overtaking.h"
#define pb push_back
using namespace std;
const int MAXN = 1e3 + 5;
vector<vector<long long> > t(MAXN, vector<long long>(MAXN));
vector<int> s;
int n, m, x;
void init(int L, int N, vector<long long> T, vector<int> W, int X, int M, vector<int> S){
for(int i = 0; i < N; i++){
t[i][0] = T[i];
}
for(int j = 1; j < M; j++){
vector<long long> ep(N);
for(int i = 0; i < N; i++){
ep[i] = t[i][j-1] + (long long)(W[i]) * (long long)(S[j] - S[j-1]);
}
for(int i = 0; i < N; i++){
long long mval = ep[i];
for(int cek = 0; cek < N; cek++){
if(t[cek][j-1] < t[i][j-1]){
mval = max(mval, ep[cek]);
}
}
t[i][j] = mval;
}
}
s = S;
n = N;
m = M;
x = X;
}
long long arrival_time(long long Y){
vector<long long> myt(m);
myt[0] = Y;
for(int j = 1; j < m; j++){
long long mval = myt[j-1] + (long long)(x) * (long long)(s[j] - s[j-1]);
for(int cek = 0; cek < n; cek++){
if(t[cek][j-1] < myt[j-1]){
mval = max(mval, t[cek][j]);
}
}
myt[j] = mval;
}
return myt[m-1];
}
# | 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... |