이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "overtaking.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using tlli = tuple<ll, ll, int>;//prev time, next time, index
ll L;
int N;
vector<ll> T;
vector<ll> W;
ll X;
int M;
vector<ll> S;
void init(int L1, int N1, std::vector<long long> T1, std::vector<int> W1, int X1, int M1, std::vector<int> S1)
{
L = L1;
N = N1;
T = T1;
for (int i: W1)
W.push_back(i);
X = X1;
W.push_back(X);
M = M1;
for (int i: S1)
S.push_back(i);
}
long long arrival_time(long long Y)
{
T.push_back(Y);
vector<vector<ll>> times(N+1);
for (int i=0; i<=N; i++)
times[i].push_back(T[i]);
for (int sorting = 1; sorting<M; sorting++)
{
ll length = S[sorting] - S[sorting-1];
vector<tlli> move;
for (int i=0; i<=N; i++)
{
move.push_back({times[i][sorting-1], times[i][sorting-1] + (length*W[i]), i});
}
sort(move.begin(), move.end());
ll running_max = -1;
for (int j=0; j<=N; j++)
{
running_max = max(running_max, get<1>(move[j]));
int i = get<2>(move[j]);
times[i].push_back(running_max);
}
}
T.pop_back();
return times[N][M-1];
}
# | 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... |