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;
int l, n, m;
long long t[1001][1001];
long long speed[1000];
long long nspeed;
long long pos[1001];
void init(int L, int N, std::vector<long long> T, std::vector<int> W, int X, int M, std::vector<int> S)
{
n=N;
l=L;
m=M;
for(int i=0; i<n; i++){
t[0][i]=T[i];
speed[i]=W[i];
}
nspeed=X;
for(int i=0; i<m; i++){
pos[i]=S[i];
}
return;
}
long long arrival_time(long long Y)
{
t[0][n]=Y;
for(int i=1; i<m; i++){
t[i][n]=0;
for(int j=0; j<n; j++){
t[i][j]=0;
for(int k=0; k<n; k++){
if(t[i-1][j]>t[i-1][k]){
t[i][j]=max(t[i][j], t[i-1][k]+speed[k]*(pos[i]-pos[i-1]));
}
}
t[i][j]=max(t[i][j], t[i-1][j]+speed[j]*(pos[i]-pos[i-1]));
t[i][j]=max(t[i][j], t[i-1][n]+nspeed*(pos[i]-pos[i-1]));
if(t[i-1][j]<t[i-1][n])
t[i][n]=max(t[i][n], t[i-1][j]+speed[j]*(pos[i]-pos[i-1]));
}
t[i][n]=max(t[i][n], t[i-1][n]+nspeed*(pos[i]-pos[i-1]));
}
return t[m-1][n];
}
# | 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... |