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;
namespace {
int L,N,X,M;
vector<int> W,S;
vector<long long> T;
}
void init(int L,int N,vector<long long> T,vector<int> W,int X,int M,vector<int> S){
W.emplace_back(X);
::L = L;
::N = N;
::T = T;
::W = W;
::X = X;
::M = M;
::S = S;
}
long long arrival_time(long long Y){
vector e(N+1,vector<long long>(M));
for(int i=0;i<N;i++)e[i][0]=T[i];
e[N][0]=Y;
for(int j=1;j<M;j++) {
for(int i=0;i<=N;i++) {
e[i][j]=e[i][j-1]+W[i]*(S[j]-S[j-1]);
}
for(int i=0;i<=N;i++) {
for(int k=0;k<=N;k++) {
if(e[k][j-1]<e[i][j-1])e[i][j]=max(e[i][j],e[k][j]);
}
}
}
return e[N][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... |