# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1038985 | Zicrus | Overtaking (IOI23_overtaking) | C++17 | 2 ms | 476 KiB |
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 <bits/stdc++.h>
#include "overtaking.h"
using namespace std;
typedef long long ll;
vector<ll> tCur, tNxt;
vector<ll> s;
ll x, m;
void init(int l, int n, vector<ll> t, vector<int> w, int x1, int m1, vector<int> s1) {
s = vector<ll>(s1.size());
for (int i = 0; i < s1.size(); i++) s[i] = s1[i];
m = m1;
x = x1;
tCur = vector<ll>(m-1);
tNxt = vector<ll>(m-1);
ll start = t[0], timePerKm = w[0];
for (int t = 0; t < m-1; t++) {
ll idealNxt = start + timePerKm * ((ll)s[t+1] - (ll)s[t]);
tCur[t] = start;
tNxt[t] = idealNxt;
start = idealNxt;
}
}
ll arrival_time(ll y) {
for (int t = 0; t < m-1; t++) {
ll idealNxt = y + x * (s[t+1] - s[t]);
if (tCur[t] < y) idealNxt = max(idealNxt, tNxt[t]);
y = idealNxt;
}
return y;
}
Compilation message (stderr)
# | 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... |