# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
843826 | ogkostya | Overtaking (IOI23_overtaking) | C++17 | 3554 ms | 16836 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 <algorithm>
#include <utility>
std::vector<std::vector<std::pair<long long, long long>>> SS(1001, std::vector<std::pair<long long, long long>>());
struct less_than_int
{
inline bool operator() (const std::pair<long long, int>& a, const std::pair<long long, int>& b)
{
return (a.first < b.first);
}
};
void sortVecPair(std::vector<long long>& vecA, std::vector<int>& vecB)
{
std::vector<std::pair<long long, int>> vecC;
vecC.reserve(vecA.size());
for (int i = 0; i < vecA.size(); i++)
{
vecC.push_back(std::make_pair(vecA[i], vecB[i]));
}
std::sort(vecC.begin(), vecC.end(), less_than_int());
vecA.clear();
vecB.clear();
vecA.reserve(vecC.size());
vecB.reserve(vecC.size());
for (int i = 0; i < vecC.size(); i++)
{
vecA.push_back(vecC[i].first);
vecB.push_back(vecC[i].second);
}
}
int _M;
std::vector<int> _S;
int _X;
void init(int L, int N, std::vector<long long> T, std::vector<int> W, int X, int M, std::vector<int> S)
{
_X = X;
_M = M;
_S = S;
sortVecPair(T, W);
for (int i = 0; i < N; i++)
{
//if (W[i] > X)
/// continue;
long long a = T[i];
for (int j = 1; j < M; j++)
{
long long b = a + 1LL * (_S[j] - _S[j - 1]) * W[i];
for (int k = 0; k < SS[j].size(); k++)
{
if (SS[j][k].first < a && SS[j][k].second > b)
b = SS[j][k].second;
}
SS[j].push_back(std::make_pair(a, b));
a = b;
}
}
return;
}
long long arrival_time(long long Y)
{
long long a = Y;
for (int j = 1; j < _M; j++)
{
long long b = a + 1LL * (_S[j]-_S[j-1]) * _X;
for (int k = 0; k < SS[j].size(); k++)
{
if (SS[j][k].first < a && SS[j][k].second > b)
b = SS[j][k].second;
}
a = b;
}
return a;
}
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... |