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 <iostream>
#include <tuple>
using namespace std;
int l,n,x,m;
vector<long long>t;
vector<int>w,s;
vector<vector<long long>>e;
void init(int L, int N, std::vector<long long> T, std::vector<int> W, int X, int M, std::vector<int> S){
tie(l,n,x,m,t,w,s)=tie(L,N,X,M,T,W,S);
e.assign(n,vector<long long>(m,0));
for(int i=0;i<n;i++){
e[i][0]=t[i];
for(int j=1;j<m;j++){
e[i][j]=e[i][j-1]+1LL*(s[j]-s[j-1])*w[i];
for(int k=0;k<i;k++)
if(e[k][j-1]<e[i][j-1])
e[i][j]=max(e[i][j],e[k][j]);
// cout<<e[i][j]<<' ';
}
// cout<<'\n';
}
return;
}
long long arrival_time(long long Y){
long long ans=Y;
for(int i=1;i<m;i++){
long long ex=ans+(s[i]-s[i-1])*x;
for(int j=0;j<n;j++){
if(e[j][i-1]<ans) ex=max(ex,e[j][i]);
}
ans=ex;
}
return ans;
}
# | 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... |