# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
955560 | Prieved1 | Overtaking (IOI23_overtaking) | C++17 | 1 ms | 348 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 "overtaking.h"
#include <bits/stdc++.h>
using namespace std;
int speed;
vector<vector<long long>> ta;
vector<int> ss;
void init(int L, int N, std::vector<long long> T, std::vector<int> W, int X, int M, std::vector<int> S) {
speed=X;
ta=vector<vector<long long>> (M, vector<long long> (N));
ss=S;
for(int i = 0;i<M;i++) {
for(int j = 0;j<N;j++) {
if(i==0)ta[i][j]=T[j];
else ta[i][j]=ta[i-1][j]+(S[i]-S[i-1])*W[j];
}
if(i){
for(int j = 0;j<N;j++){
for(int k = 0;k<N;k++) {
if(ta[i-1][j]>ta[i-1][k])ta[i][j]=max(ta[i][j], ta[i][k]);
}
}
}
}
}
long long arrival_time(long long Y) {
long long pr=Y;
long long cur=pr;
for(int i = 1;i<ta.size();i++) {
cur+=(ss[i]-ss[i-1])*speed;
for(int j = 0;j<ta[i].size();j++) {
if(ta[i-1][j]<pr)cur=max(cur, ta[i][j]);
}
pr=cur;
}
return cur;
}
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... |