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;
using ll = long long;
using pii = pair<int, int>;
int l, n, m, x;
vector<int> w, s;
vector<ll> t;
vector<vector<int>> e, ct;
void init(int L, int N, std::vector<long long> T, std::vector<int> W, int X, int M, std::vector<int> S){
l = L; n = N; t = T; w = W; x = X; m = M; s = S;
return;
}
long long arrival_time(long long Y){
e = vector<vector<int>>(n + 1, vector<int>(m));
ct = vector<vector<int>>(n + 1, vector<int>(m));
for (int i = 0; i < n; i++) ct[i][0] = t[i];
ct[n][0] = Y;
for (int j = 1; j < m; j++) {
map<int, vector<int>> mp;
int cmx = 0;
for (int i = 0; i < n; i++) {
e[i][j] = ct[i][j - 1] + w[i] * (s[j] - s[j - 1]);
mp[ct[i][j - 1]].emplace_back(i);
}
e[n][j] = ct[n][j - 1] + x * (s[j] - s[j - 1]);
mp[ct[n][j - 1]].emplace_back(n);
for (auto &[x, y]: mp) {
for (auto &E: y) ct[E][j] = max(e[E][j], cmx);
for (auto &E: y) cmx = max(cmx, e[E][j]);
}
}
return ct[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... |