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>
#define int long long
using namespace std;
const int N=1005;
int a[N],b[N],c[N],n,m,t[N][N],e[N][N];
void init(int32_t L, int32_t N, vector<long long> T, vector<int32_t> W, int32_t X, int32_t M, vector<int32_t> S)
{
n=N,m=M;
for (int i=0;i<n;i++) a[i]=T[i],b[i]=W[i];
for (int i=0;i<m;i++) c[i]=S[i];
b[n]=X;
return;
}
long long arrival_time(long long Y)
{
a[n]=Y;
for (int i=0;i<=n;i++) t[i][0]=a[i];
for (int j=1;j<m;j++){
for (int i=0;i<=n;i++){
t[i][j]=e[i][j]=t[i][j-1]+b[i]*(c[j]-c[j-1]);
}
for (int i=0;i<=n;i++){
for (int k=0;k<=n;k++){
if (t[k][j-1]<t[i][j-1]) t[i][j]=max(t[i][j],e[k][j]);
}
}
}
return t[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... |