This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/* Ignut
started: 14.08.2024
now: 14.08.2024
████████████████████████████████████████████████████████████████████
████████████████████████████████ ████████████████████████████████
██████████████████████████████ ██████████████████████████████
██████ ██████████████████ ██████████████████ ██████
██████ ██████████████ ██████████████ ██████
██████ ██ ████████████ ████████████ ██ ██████
██████ ████ ██████████ ██████████ ████ ██████
██████ ████ ██████████ ██████████ ████ ██████
██████ ████ ██████████ ██████████ ██████ ██████
██████ ██████ ██████████ ██████████ ██████ ██████
██████ ██████ ████████ ████████ ██████ ██████
██████ ██████ ██████ ██████ ██████ ██████
██████ ████ ████ ████ ████ ██████
██████ ██████████ ████ ██████████ ██████
██████ ██ ██████ ████████ ██████ ██ ██████
██████ ██████ ████████ ██████ ██████
██████ ██ ██ ██████
██████████████████████ ████ ████ ██████████████████████
████████████████████████ ██ ██ ████████████████████████
██████████████████████████ ██████████████████████████
██████████████████████████████ ██████████████████████████████
████████████████████████████████████████████████████████████████████
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int l;
int n, m;
vector<ll> t;
vector<int> w;
vector<int> s;
int x;
void init(int L, int N, vector<ll> T, vector<int> W, int X, int M, vector<int> S) {
l = L; n = N; m = M; w = W; s = S; x = X; t = T;
}
ll arrival_time(ll Y) {
// <tm, speed>
vector<pair<ll, int>> vec;
for (int i = 0; i < n; i ++) if (w[i] > x) vec.push_back({t[i], w[i]});
vec.push_back({Y, x});
sort(vec.begin(), vec.end());
for (int i = 1; i < m; i ++) {
vector<pair<ll, int>> next;
ll maxTime = 0;
for (auto [tm, sp] : vec) {
ll e = tm + 1ll * (s[i] - s[i - 1]) * sp;
next.push_back({max(e, maxTime), sp});
maxTime = max(e, maxTime);
}
vec = next;
sort(vec.begin(), vec.end());
// for (auto [tm, sp] : vec) {
// cout << tm << '_' << sp << ' ';
// }
// cout << '\n';
}
// cout << '\n';
for (auto [tm, sp] : vec) if (sp == x) return tm;
return Y + 1ll * l * x;
}
# | 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... |