이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <vector>
#include <algorithm>
#define ll long long
using namespace std;
struct Bus {
ll start, speed, arrive;
};
int l, n, x, m;
vector<int> s;
vector<Bus> a;
bool srt(Bus a, Bus b) {
return a.start < b.start;
}
void init(int el, int en, vector<ll> t, vector<int> w, int ex, int em, vector<int> es) {
l = el, n = en, x = ex, m = em, s = es;
a = vector<Bus>(n);
for(ll i = 0; i < n; i++) {
a[i].start = t[i];
a[i].speed = w[i];
}
sort(a.begin(), a.end(), srt);
for(ll i = 0; i < n; i++) a[i].arrive = max(a[i].start+a[i].speed*l, (i == 0 ? 0 : a[i-1].arrive));
}
ll arrival_time(ll y) {
ll l = 0, r = n, mid, ans = n;
while(l<=r) {
mid = (l+r)/2;
if(a[mid].start > y) {
ans = mid;
r = mid-1;
} else l = mid+1;
}
return max(y+x*l, (ans == 0 ? 0 : a[ans-1].arrive));
}
# | 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... |