이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/*
Mayoeba Yabureru
*/
#include<bits/stdc++.h>
using namespace std;
int l, n, x, m;
vector<int> s;
vector<pair<long long, int>> buses;
vector<vector<pair<long long, int>>> times;
vector<vector<pair<long long, long long>>> max_times;
long long arrival_time(long long time) {
long long ans = time;
for (int i = 1; i < m; i ++) {
long long past_time = ans, speed = x, delta_time = s[i] - s[i - 1], time = past_time + speed * delta_time;
for (auto [x, y] : max_times[i]) {
if (x < past_time) time = max(time, y);
}
ans = time;
}
return ans;
}
void init(int L, int N, std::vector <long long> T, std::vector <int> W, int X, int M, std::vector <int> S) {
l = L, n = N, x = X, m = M, s = S;
for (int i = 0; i < N; i ++) {
if (W[i] < X) continue;
buses.push_back({T[i], W[i]});
}
n = buses.size();
times.push_back(buses);
vector<pair<long long, long long>> bb;
max_times.push_back(bb);
for (int i = 1; i < m; i ++) {
sort(times[i - 1].begin(), times[i - 1].end());
long long max_time = 0, delta_time = S[i] - S[i - 1];
vector<pair<long long, int>> a;
vector<pair<long long, long long>> b;
for (int j = 0; j < n; j ++) {
long long past_time = times[i - 1][j].first, speed = times[i - 1][j].second;
long long time = past_time + speed * delta_time;
max_time = max(max_time, time);
a.push_back({max_time, speed});
b.push_back({past_time, max_time});
}
times.push_back(a);
max_times.push_back(b);
}
}
# | 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... |