Submission #1071124

#TimeUsernameProblemLanguageResultExecution timeMemory
1071124Muhammad_AneeqOvertaking (IOI23_overtaking)C++17
39 / 100
3553 ms8432 KiB
#include <vector> #include <map> #include <iostream> using namespace std; int const N=1010,M=1010; long long reach[N][M]={}; int n,m; long long st[N],sp[N]; int stops[N]; void init(int L, int N, vector<long long> T, vector<int> W, int X, int M, vector<int> S) { n=N,m=M; for (int i=0;i<n;i++) st[i]=T[i]; for (int i=0;i<n;i++) sp[i]=W[i]; for (int i=0;i<m;i++) stops[i]=S[i]; sp[n]=X; } void comp() { map<long long,vector<int>>d; for (int i=0;i<=n;i++) { reach[i][0]=st[i]; d[st[i]].push_back(i); } for (int i=1;i<m;i++) { long long pre=0; for (auto j:d) { long long mn=0; for (auto k:j.second) { reach[k][i]=reach[k][i-1]+sp[k]*(stops[i]-stops[i-1]); reach[k][i]=max(pre,reach[k][i]); mn=max(mn,reach[k][i]); } pre=max(pre,mn); } d.clear(); for (int j=0;j<=n;j++) d[reach[j][i]].push_back(j); } } long long arrival_time(long long Y) { st[n]=Y; comp(); return reach[n][m-1]; }
#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...