# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1067671 | vjudge1 | Overtaking (IOI23_overtaking) | C++17 | 3537 ms | 71404 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;
typedef long long ll;
map<ll,ll> station[1010];
#define MP make_pair
vector<ll> dis;
ll dp[1010][1010];
ll sped;
int M;
void init(int L, int N, vector<ll> T, vector<int> W, int X, int M_, vector<int> S){
for(auto i:S)dis.push_back(i);
sped=X;
M=M_;
for(int i=1;i<=N;i++)
dp[i][0]=T[i-1];
for(int j=1;j<M;j++) {for(int i=1;i<=N;i++)
dp[i][j]=dp[i][j-1]+(dis[j]-dis[j-1])*W[i-1];
vector<int>V(N);
iota(V.begin(),V.end(),1);
sort(V.begin(),V.end(),[j](int a,int b){
return MP(dp[a][j-1],dp[a][j])<
MP(dp[b][j-1],dp[b][j]);
});
ll prv=0;
for(auto i:V)
prv=dp[i][j]=max(dp[i][j],prv);
}
for(int i=1;i<=N;i++) for(int j=1;j<M;j++)
station[j-1][dp[i][j-1]]=max(station[j-1][dp[i][j-1]],dp[i][j]);
for(int j=0;j<M-1;j++)
station[j][-1]=0;
}
ll arrival_time(ll Y){
for(int i=0;i<M-1;i++)
Y=max(Y+sped*(dis[i+1]-dis[i]),(--station[i].lower_bound(Y))->second);
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... |