Submission #981029

#TimeUsernameProblemLanguageResultExecution timeMemory
981029vjudge1Overtaking (IOI23_overtaking)C++17
39 / 100
3561 ms596 KiB
#include "overtaking.h" #include <bits/stdc++.h> using namespace std; using ll = long long; using vll = vector <ll>; using vi = vector <int>; const ll MAXN = 1E3+16; ll l, n, x, m; vll t; vi w, s; // bus i moves 1 km in w[i] s/km void init (int L, int N, vll T, vi W, int X, int M, vi S) { l = L; n = N; x = X; m = M; t = T; w = W; s = S; w.push_back(X); } ll arrival_time (ll y) { vll ts = t; ts.push_back(y); for (ll i = 1; i < m; i++) { ll dis = s[i]-s[i-1]; vll e(n+1); for (ll j = 0; j <= n; j++) { e[j] = ts[j] + dis*w[j]; } vll nt(n+1); for (ll j = 0; j <= n; j++) { nt[j] = e[j]; for (ll k = 0; k <= n; k++) { if (ts[k] < ts[j]) nt[j] = max(nt[j], e[k]); } } ts = nt; } return ts[n]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...